Google Answers Logo
View Question
 
Q: [mysql][php] SELECT info on 3 tables using JOIN and IF ELSE ( No Answer,   1 Comment )
Question  
Subject: [mysql][php] SELECT info on 3 tables using JOIN and IF ELSE
Category: Computers > Programming
Asked by: jolly9-ga
List Price: $2.00
Posted: 06 Sep 2006 09:53 PDT
Expires: 06 Oct 2006 09:53 PDT
Question ID: 762731
I have to get information out of 3 tables:

I am showing you the string which i am using at the moment:
With this i get a list of cities which contain description in Dutch

[code]

SELECT 
tabel2.main_id, 
tabel3.stad_naam, 
COUNT(*) AS count 
FROM 
tabel1, 
tabel2, 
tabel3 
WHERE 
tabel2.main_id=tabel1.main_id AND 
tabel2.omschrijving_id='1' AND 
tabel2.land='fr' AND 
tabel1.stad_id=tabel3.stad_id AND 
tabel3.taal='nl' 
GROUP BY stad_id 
ORDER BY stad_naam ASC

[/code]

But! the name of the cities should be desplayed Dutch as well ...if present...
(So for Paris it will be Parijs)

Now...
table3 containts all the cities with:
- language code
- name of the city (in multiple language IF present!)
- city_id

A city in an other language has the SAME city_id
but not all cities are tranlated in Dutch
For these fields i put in NULL

How can i using IF ELSE or CASE 
put this in the Query show above?

And can i COUNT the total row at the same time?

Regards!
Answer  
There is no answer at this time.

Comments  
Subject: Re: [mysql][php] SELECT info on 3 tables using JOIN and IF ELSE
From: frankcorrao-ga on 08 Sep 2006 11:58 PDT
 
look up the keyword 'coalesce'.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy