Subject | Re: [firebird-support] Newbie question: What am I doing wrong with this SQL |
---|---|
Author | Wei Yu |
Post date | 2004-05-07T21:22:59Z |
Hi, All
I've figured it out, should use LEFT OUTER JOIN, thanks anyway
William
william_yuwei <william_yuwei@...> wrote:
Hi, All
I have following SQL, which I want to return all the clients record
even its country id or salsrep id is null, but it didn't give me
what I want even I do have records in the clients, and also even I
create all the indexes against all ID fields for all tables, but
under plan, it still use NATURAL against all the tables, Please tell
me what am I doing wrong?
SELECT CLIENTS.*,
COUNTRY.NAME AS COUNTRYNAME,
SALESREP.NAME AS SALESMAN,
CREDITSTATUS.DESCRIPTION,
CREDITSTATUS."LEVEL" FROM CLIENTS
RIGHT JOIN COUNTRY ON COUNTRY.ID = CLIENTS.COUNTRY_ID
RIGHT JOIN SALESREP ON SALESREP.ID = CLIENTS.SALEREP_ID
RIGHT JOIN CREDITSTATUS ON CREDITSTATUS.ID =
CLIENTS.CREDITSTATUS_ID
Thanks
William
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
William, Yu
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
[Non-text portions of this message have been removed]
I've figured it out, should use LEFT OUTER JOIN, thanks anyway
William
william_yuwei <william_yuwei@...> wrote:
Hi, All
I have following SQL, which I want to return all the clients record
even its country id or salsrep id is null, but it didn't give me
what I want even I do have records in the clients, and also even I
create all the indexes against all ID fields for all tables, but
under plan, it still use NATURAL against all the tables, Please tell
me what am I doing wrong?
SELECT CLIENTS.*,
COUNTRY.NAME AS COUNTRYNAME,
SALESREP.NAME AS SALESMAN,
CREDITSTATUS.DESCRIPTION,
CREDITSTATUS."LEVEL" FROM CLIENTS
RIGHT JOIN COUNTRY ON COUNTRY.ID = CLIENTS.COUNTRY_ID
RIGHT JOIN SALESREP ON SALESREP.ID = CLIENTS.SALEREP_ID
RIGHT JOIN CREDITSTATUS ON CREDITSTATUS.ID =
CLIENTS.CREDITSTATUS_ID
Thanks
William
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
William, Yu
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
[Non-text portions of this message have been removed]