By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,152 Members | 2,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,152 IT Pros & Developers. It's quick & easy.

Left Join

P: n/a
Hi: Can any one please tell me how do i change my query so that it also
shows the records from table Main which are not in table [star
Redemption]. I try to use the LEFT Join but it gives syntax error.

Thanks.

SELECT q1.Name, q1.Tot-q2.Tot AS StarBalance
FROM [Select [Name], Sum(Main.[#_Stars]) as Tot
>From Main
Group By [Name]
]. AS q1 INNER JOIN [Select [CRC],
Sum(Val(Replace(nz(Prize,0),"$",""))) as Tot
>From [star Redemption]
Group By [CRC]
]. AS q2 ON q1.Name = q2.CRC;

Nov 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

To do this, you need to put an "Is Null" condition on the join field in
the right table, which appears to be q2.CRC here...

Ross La Haye
co*********@gmail.com wrote:
Hi: Can any one please tell me how do i change my query so that it also
shows the records from table Main which are not in table [star
Redemption]. I try to use the LEFT Join but it gives syntax error.

Thanks.

SELECT q1.Name, q1.Tot-q2.Tot AS StarBalance
FROM [Select [Name], Sum(Main.[#_Stars]) as Tot
From Main
Group By [Name]
]. AS q1 INNER JOIN [Select [CRC],
Sum(Val(Replace(nz(Prize,0),"$",""))) as Tot
From [star Redemption]
Group By [CRC]
]. AS q2 ON q1.Name = q2.CRC;
Nov 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.