Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Whats the error with this SQL

Author  Topic 

anchoredwisdom
Starting Member

22 Posts

Posted - 2009-08-28 : 02:10:21
select S1.X,S2.Y
from
(
select count(*) as X from biw_01.sales_order_line_dim
where
sales_order_line_type = 'UK Internal Line'

) S1
inner join
(

select count(*) as Y from biw_01.sales_order_line_dim
where
sales_order_line_type = 'UK Trial'

) S2



Can anyone provide me a sample SQL in the above scenario

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-08-28 : 02:17:19
[code]SELECT COUNT(CASE WHEN sales_order_line_type = 'UK Internal Line' THEN 1 END)X,
COUNT(CASE WHEN sales_order_line_type = 'UK Trial' THEN 1 END)Y
FROM biw_01.sales_order_line_dim[/code]


Hope can help...but advise to wait pros with confirmation...
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-28 : 02:39:54
quote:
Originally posted by anchoredwisdom

select S1.X,S2.Y
from
(
select count(*) as X from biw_01.sales_order_line_dim
where
sales_order_line_type = 'UK Internal Line'

) S1
inner cross join
(

select count(*) as Y from biw_01.sales_order_line_dim
where
sales_order_line_type = 'UK Trial'

) S2

Can anyone provide me a sample SQL in the above scenario




N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -