DaveLinger Posted July 13, 2006 Share Posted July 13, 2006 here's the deal. I'm still working on the game review site. Each review has a section id, (2 digits, like "12") which are related to which platforms the game is on. An example:12 - PS213 - Xbox14 - PC15 - PS2 and Xbox16 - PS2 and Xbox and PC17 - Xbox and PCI have 2 lists of reviews, one for Xbox games, one for PS2 games. I was hoping to have MySQL select the results of rows with EITHER "12" OR "15" OR "16" on the PS2 list, so that on the Xbox list I could have it select 13 15 16 and 17. Is there an easy way to add this into my existing code? right now it's something like:SELECT * FROM my_table WHERE sid = '12' ORDER BY title DESC Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/ Share on other sites More sharing options...
hvle Posted July 13, 2006 Share Posted July 13, 2006 do you have a field that contains the game type, like PS2, Xbox, or PC?something like this:sid types:12 PS213 Xbox14 PC15 PS2,Xbox16 PS2,Xbox,PCu know? it's much easier if you have a field in database which indicated the type of games for each review. Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57072 Share on other sites More sharing options...
DaveLinger Posted July 13, 2006 Author Share Posted July 13, 2006 I do, why does that matter? Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57074 Share on other sites More sharing options...
hvle Posted July 13, 2006 Share Posted July 13, 2006 it is matter because you don't have to remember: id 12 is ps2, id 13 is xbox. u knowsay you got a field called types, you can organize your query like this:... where types like '%xbox%';and it will return all row which contain xbox. Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57077 Share on other sites More sharing options...
Barand Posted July 13, 2006 Share Posted July 13, 2006 SELECT * FROM my_table WHERE sid IN (12,15,16) ORDER BY title DESC Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57138 Share on other sites More sharing options...
ShogunWarrior Posted July 13, 2006 Share Posted July 13, 2006 PS: Checking indexes/numbers is much faster than wildcard search, you should avoid it if unneccesary. Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57212 Share on other sites More sharing options...
DaveLinger Posted July 13, 2006 Author Share Posted July 13, 2006 Thanks guys. Link to comment https://forums.phpfreaks.com/topic/14434-select-where-rowvalue-or-where-rowvalue/#findComment-57267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.