crashmaster Posted March 22, 2009 Share Posted March 22, 2009 Hi there, how to make sql query, where I can choos several IDs (primary keys) ?? For example: I have tabel where I have 1000 rows with unique ID each,, Hot can I choose rows with ID (for ex.) 10, 13,22,45,50 by ONE query ?? $q = mysql_query(" SELECT id,img_src,copyright FROM videa WHERE id = '138' AND id = '137' "); It doesnt work... ((( Quote Link to comment https://forums.phpfreaks.com/topic/150628-solved-multiple-id/ Share on other sites More sharing options...
Maq Posted March 22, 2009 Share Posted March 22, 2009 SELECT id, img_src, copyright FROM videa WHERE id IN (10, 13, 22, 45, 50) Quote Link to comment https://forums.phpfreaks.com/topic/150628-solved-multiple-id/#findComment-791244 Share on other sites More sharing options...
crashmaster Posted March 22, 2009 Author Share Posted March 22, 2009 SELECT id, img_src, copyright FROM videa WHERE id IN (10, 13, 22, 45, 50) Thank you Quote Link to comment https://forums.phpfreaks.com/topic/150628-solved-multiple-id/#findComment-791255 Share on other sites More sharing options...
Maq Posted March 22, 2009 Share Posted March 22, 2009 Think about this, if you try to get the results where id = 138 and id = 137 there will never be a result because the id is unique... WHERE id = '138' AND id = '137' Welcome Quote Link to comment https://forums.phpfreaks.com/topic/150628-solved-multiple-id/#findComment-791264 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.