Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: sql help for a query
10-16-2013, 10:02 PM #1
- Join Date
- Mar 2006
- Thanked 0 Times in 0 Posts
sql help for a query
Hi, i have a table (listProfiles) that has 3 fields (id, profile, list). Say i have 5 entries in that table.
I need to do a query where i get the profile (second column) that contains the list (third column) 1 AND 2 AND 3. IF i do do something like this :
SELECT * FROM listProfiles WHERE list=1 AND list=2 AND list=3
10-16-2013, 10:32 PM #2
Not at all as simple as that.
Code:SELECT P1.* FROM listProfiles AS P1, listProfiles AS P2, listProfiles AS P3 WHERE P1.profile = P2.profile AND P1.profile = P3.profile AND P1.list=1 AND P2.list=2 AND P3.list=3
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Users who have thanked Old Pedant for this post: