A post for the technically minded of you - TyrionXavier - 08-30-2004
<div class='sqltop'>SQL</div><div class='sqlmain'>[color=blue;font-weight:bold]SELECT[/color] ch.*, Customers.FirstName
AS FirstName, Customers.LastName
AS LastName,
SUM(Loan.LoanAmount)
AS LoanAmount
FROM ChequeHeaders ch
LEFT OUTER
JOIN Customers ON Customers.SocialInsuranceNumber
=ch.SocialInsuranceNumber
LEFT OUTER
JOIN Loans ON ch.SocialInsuranceNumber
= Loan.SocialInsuranceNumber
WHERE (Loan.LoanType
='NEW' OR Loan.LoanType
='REN' or loan.loantype is null)
AND ch.ChequeDate
='20040827'
GROUP BY ch.SocialInsuranceNumber, ch.ID, ch.Bank, ch.Amount, ch.ChequeDate, ch.Type, ch.Notes, ch.TimeOfStart, ch.TimeOfCompletion, ch.AmountToClient, ch.Charge, ch.ChequeNumber, ch.NSF, ch.NSFDate, ch.NSFCharge, ch.Payor, Customers.FirstName, Customers.LastName
</div>
Can anybody tell me what the hell is wrong with that? I get an error returned that says "Syntax error." and that's all the help it gives me.
A post for the technically minded of you - leucetios - 08-30-2004
This probably isn't it, but the only thing I noticed is that you didn't use the same case on "or loan.loantype is null"
I dunno if your SQL install is case sensitve or not. Other than that, just eyeballing it it looks right. All the commas and parenthesis in the right spots.
Plus. When I try to run it I don't get a syntax error. I get errors because those tables don't exist in my database, but no syntax error. I can force a syntax error with an extra ) but as it is it tries to run.
Sorry :S
A post for the technically minded of you - TyrionXavier - 08-30-2004
AHAH! I just fuckin figured it out.
Second join... joins the "Loans" table, rest of the query refers to it as "Loan.Field"... Loans is incorrect, it needs to be Loan.
Stupid fucking retarded MSSQL!
A post for the technically minded of you - leucetios - 08-30-2004
there's a smiley for that you know
:puke:
A post for the technically minded of you - leucetios - 08-30-2004
I'd buy that. But they give me something to do other than work
A post for the technically minded of you - leucetios - 08-30-2004
Macromedia Fireworks
A post for the technically minded of you - Banana - 08-30-2004
I'm strangely aroused by this conversation.
A post for the technically minded of you -
CodeWarrior - 08-30-2004
Quote:Originally posted by leucetios@Aug 30 2004, 01:16 PM
Macromedia Fireworks
[snapback]66974[/snapback]
I use that too!!!!!!!!!
And when I get lazy I use Flash.