Select userid from table where asset in (select asset from table where userid = user1)
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Tim Gornall
Sent: Wednesday, October 22, 2008 10:41 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL question
I ended up doing this in two parts, and was wondering how/if it could be done in one statement. The table contains two columns: UserID and Asset.
I need to determine all the assets associated with UserID = user1. Then using that result set, all the users associated with those assets.
The end result would look something like this:
User1 asset1
User1 asset2
User1 asset3
User5 asset2
User8 asset1
User8 asset3
Anyone want to take a stab at it?
Thanks, Tim
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
No virus found in this incoming message.
Checked by AVG -
http://www.avg.com
Version: 8.0.175 / Virus Database: 270.8.2/1739 - Release Date: 10/22/2008 7:23 AM
As an Amazon Associate we earn from qualifying purchases.