Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help with Select SQL
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00096128
Message ID:
00096915
Views:
20
>I'm wondering if I need to get so complicated for this. All I need is a list of clients and their paysources that appear in either the ver table or the bal table. Since both tables have both client number and paysource in them, do I even really need to use the clients table at all?

Ah-ha! Right you are. You only need to select from the two tables that have billable clients in them, since you don't care about clients (in the Clients table) that are not billable. So, all you need is a single join:

SELECT DISTINCT Client_num, Client_SRC, FName, LName ;
FROM Ver ;
UNION ;
SELECT DISTINCT Client_num, Client_SRC, FName, LName ;
FROM Bal ;
INTO CURSOR Billable_Clients

Again, the UNION will filter any rows that appear in both tables. This should be acceptably fast, too. Oh, I like it. Let us all know if this doesn't give you the right results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform