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... ((( 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) 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 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 Link to comment https://forums.phpfreaks.com/topic/150628-solved-multiple-id/#findComment-791264 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.