Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with sql
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01156945
Message ID:
01156957
Views:
13
select t1.released_by, url.name as released_name, 
       t1.prepared_by, upr.name as prepared_name, 
       t1.approved_by, uap.name as approved_name,
       t1.reviewed_by, urv.name as reviewed_name 
From table1 t1
	JOIN users url ON url.loginid = t1.released_name
	JOIN users upr ON upr.loginid = t1.prepared_name
	JOIN users uap ON uap.loginid = t1.approved_name
	JOIN users urv ON urv.loginid = t1.reviewed_name
>I can't figure this out...2 tables.
>
>
>Table1.dbf
>id
>released_by
>prepared_by
>approved_by
>reviewed_by
>
>
>where all the *_by fields match a loginid in the users table. I need to get the name field from the user table.
>
>
>users.dbf
>loginid
>name
>
>
>so something like:
>
>
>select a.released_by, b.name as released_name, ;
>       a.prepared_by, b.name as prepared_name, ;
>       a.approved_by, b.name as approved_name, ;
>       a.reviewed_by, b.name as reviewed_name ;
>From table1 a, users b
>
>
>This is where I am stuck, can't get the join quite like it needs to be....
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform