Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch 22 on group by
Message
From
22/05/2001 14:04:31
 
 
To
22/05/2001 08:06:05
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00508311
Message ID:
00510003
Views:
25
>>How does SQL Server know that all the values are the same?
>
>when there is a join on a unique key -

In theory this could work. It would require that the Declared key be included in the GROUP BY. But it's still a special case of the general issue, albeit, one that could be handled as an exception by SQL Server.

>all I can say is that VFP does it and doesn't seem to have any trouble with it - this is one (maybe the only one) aspect of VFP's implementation of SQL that I like better than SQL Server ...

This is a situation where VFP's implementation of SQL does not follow the ANSI standard.

BTW, there is a solution for SQL Server using corralated queries:

SELECT st.id, st.name, st.capital,
(SELECT COUNT(*) FROM cities WHERE st_id = st.id) AS NumOfCities
FROM states st
...

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform