Jump to content

Select where row=value OR where row=value?


DaveLinger

Recommended Posts

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 - PS2
13 - Xbox
14 - PC
15 - PS2 and Xbox
16 - PS2 and Xbox and PC
17 - Xbox and PC

I 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
Share on other sites

do you have a field that contains the game type, like PS2, Xbox, or PC?
something like this:

sid    types:
12    PS2
13    Xbox
14    PC
15    PS2,Xbox
16    PS2,Xbox,PC


u know? it's much easier if you have a field in database which indicated the type of games for each review. 
Link to comment
Share on other sites

it is matter because you don't have to remember: id 12 is ps2, id 13 is xbox. u know

say 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.