Jump to content

selecting table rows


maddogandnoriko

Recommended Posts

I am building a tv database site and will eventually support multiple languages.  My db has a table with non-language based info and another table that has a couple of language based rows(show description&title). What I need help with is the language row selection. I get the 'base info and left join the useres language info. Simple. But what I would like is:

 

select base info left join language info(get users language info BUT if that doesn't exist use english info instead)

 

Can this be done in one query?

 

Thank you very much for ANY advice given

Todd

Link to comment
Share on other sites

Assuming you have to fetch information dependent on the user's language multiple times, I think it'd be wiser to store it in a variable, or even in the session and insert this in each query. Should put less stress on the database, also your queries will be shorter ;)

Link to comment
Share on other sites

The users info is stored in a session variable. I was not clear...I tend to do that.

 

Say the spanish user is viewing the 'Lost' television show. If he wants to view episode 1 info I am now:

 

query#1: getting episode 1 info that is the same for all languages, original airdate, rating, airtime etc.

 

query #2: getting the info translated into spanish(title, description)

 

what i want to do in 1 query  is get the base episode info and the spanish description, but if the spanish description is empty, get the english description.

 

Todd

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.