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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to group the data

Author  Topic 

chavamex2604
Starting Member

1 Post

Posted - 2011-04-01 : 10:58:02
Hi i have the following query
SELECT eol,Goods,Fails,(((Goods*100)/Fails)) AS "%Yield" FROM
(select testname as eol from eoldata group by testname) W
cross join
(SELECT Testname,COUNT(*) as Goods FROM eoldata where dates between '3/31/2011 06:00:00' and '3/31/2011 16:00:00' and status='OK' group by testname) Y
CROSS JOIN
(SELECT COUNT(TestName) AS Fails FROM eoldata where dates between '3/31/2011 06:00:00' and '3/31/2011 16:00:00'group by testname) Z

but when i get the result it show

PCBW302 564 626 90
PH2EOL1 564 626 90
EOL01 564 626 90
EOLchimes 564 626 90
blank space and again same information but diferen values
PCBW302 25 626 3
PH2EOL1 25 626 3
EOL01 25 626 3
EOLchimes 25 626 3

it supose to group by first column

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-01 : 11:45:46
You should read in books online what a cross join is doing.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -