SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Sql Help
-
May 27, 2002, 20:20 #1
Sql Help
I know its the wrong board but i need some quick help.
Anyone know how to select userid from table2 where userid doesnt exsist in table1?
Anyone know how to select from table2 where userid is in more than one row.
Im trying to find where these extra userid's came from.
-
May 27, 2002, 20:27 #2
-
May 27, 2002, 21:01 #3
- Join Date
- Jul 1999
- Location
- Chicago
- Posts
- 2,629
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Likewise for the second one. If you are not using MySQL:
Code:SELECT userid FROM table1 WHERE userid IN (SELECT userid FROM table1);
-
May 28, 2002, 02:54 #4
- Join Date
- Jan 2001
- Location
- Alkmaar, Netherlands
- Posts
- 710
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Anyone know how to select userid from table2 where userid doesnt exsist in table1?
select * from table2
LEFT JOIN table1 ON table2.userid = table1.userid WHERE table1.userid is NULL
---------------------------
Anyone know how to select from table2 where userid is in more than one row.
SELECT userid, count(userid) as useridcount FROM table1 GROUP BY userid HAVING useridcount > 1
---------------------------------
-
May 28, 2002, 18:24 #5
Thanks
Thanks sylow. Just what i needed.
Bookmarks