Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with another query
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00707822
Message ID:
00708562
Views:
16
Thanks for your help.
That almost works, but what i needed is the record count of the select, not the top 1. I finished it up in VFP with SQL pass through.


>Try
select iproductid, caccount, count(caccount) as cnt,
>		( SELECT TOP 1 COUNT(name)
>			FROM customer c2
>			WHERE c2.iproductid = c1.iproductid
>				AND c2.caccount = c2.caccount
>			GROUP BY name ORDER BY COUNT(name) DESC) AS AS namecount
>	from customer c1
>	group by iproductid,caccount
>	having count(caccount)>2
>	order by iproductid,cnt
>
>>Now I want another column that tells me "of those customers using the same credit card, how many have the same last name?"
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform