tyweed Posted June 17, 2008 Share Posted June 17, 2008 I'm completely confused as to why this is not working? I have a comma seperated list of variables i check using the in shortcut vs having to list multiple or's. ============== table example query================ id user_id groupname 1 1 test 2 3 test 3 2 test 23 1 thisisnew 22 10 test ============================================= Select user_id from user_id_groupname where groupname in ('test,thisisnew') is returning zero? but Select user_id from user_id_groupname where groupname='test' or groupname='thisisnew' returns: The corret response user_id 1 3 2 1 10 I have no idea what is heppening I though in is just a shorthand for testing multiple or's? whats going on? Link to comment https://forums.phpfreaks.com/topic/110651-solved-trying-to-use-in-shortcut-its-giving-me-zero-returned-but-long-way-works/ Share on other sites More sharing options...
hitman6003 Posted June 17, 2008 Share Posted June 17, 2008 each item in the IN clause should be separate: SELECT ... FROM ... WHERE groupname IN('test', 'thisisnew') Link to comment https://forums.phpfreaks.com/topic/110651-solved-trying-to-use-in-shortcut-its-giving-me-zero-returned-but-long-way-works/#findComment-567666 Share on other sites More sharing options...
tyweed Posted June 17, 2008 Author Share Posted June 17, 2008 boy am i stupid thanks! Link to comment https://forums.phpfreaks.com/topic/110651-solved-trying-to-use-in-shortcut-its-giving-me-zero-returned-but-long-way-works/#findComment-567675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.