Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by and count on union select
Message
 
 
To
08/05/2008 14:19:03
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01315922
Message ID:
01315923
Views:
19
This message has been marked as the solution to the initial question of the thread.
>I have a union select like this:
>
>
select count(*) as MembersCount, NoMember, ;
Members.LastName, Members.FirstName from (
>SELECT Personal.NoMember FROM Personal;
> UNION;
>SELECT Personal.NoMember2 AS NoMember FROM Personal;
> UNION;
>SELECT Personal.NoMember3 AS NoMember FROM Personal) ;
InnerSQL inner join Members on InnerSQL.NoMember = Members.MemberID ;
group by NoMember, LastName, FirstName
>
>
>Now, I need to enhance that select so I can have a group by NoMember with the COUNT(*). And, I also need to INNER JOIN that to the Member table so I will be able to get the first name and last name.
>
>I am not sure about the proper syntax for that. I guess I will need to have some sub select.

You can use derived table. See corrections inline.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform