Topic awaiting preservation: Dynamic SQL Problem |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: NZ |
posted 10-30-2003 09:18
Hi, guys. How are you? code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory INNER JOIN (Tbladd INNER JOIN Tblstate ON Tbladd.State = Tblstate.ID ) ON Tbladd.Category = Tblcategory.ID "
|
Paranoid (IV) Inmate From: France |
posted 10-30-2003 09:25
Hiroki: double check what you write. If the "state" field is empty the sql string has no clause Where. Well, I'm reluctant to ASP, but here comes a ( try of ) bug fix code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory INNER JOIN (Tbladd INNER JOIN Tblstate ON Tbladd.State = Tblstate.ID ) ON Tbladd.Category = Tblcategory.ID Where" Sorry, I have no ASP server, nor do I remember the syntax of the if then else statement in ASP. Whatever, it's ugly, but it should work. code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory, Tblstate, Tbladd WHERE Tbladd.Category = Tblcategory.ID AND Tbladd.State = Tblstate.ID" I may have forgotten some things but you got the idea. |
Paranoid (IV) Inmate From: NZ |
posted 10-30-2003 22:00
Hi, Poi. Many many thanks for pointing my mistakes. code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory INNER JOIN (Tbladd INNER JOIN Tblstate ON Tbladd.State = Tblstate.ID ) ON Tbladd.Category = Tblcategory.ID Where"
code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory INNER JOIN (Tbladd INNER JOIN Tblstate ON Tbladd.State = Tblstate.ID ) ON Tbladd.Category = Tblcategory.ID "
quote:
|
Paranoid (IV) Inmate From: France |
posted 10-31-2003 05:32
[quick reply] code: sql = "SELECT Title, Colcategory, Price, Colstate FROM Tblcategory INNER JOIN (Tbladd INNER JOIN Tblstate ON Tbladd.State = Tblstate.ID ) ON Tbladd.Category = Tblcategory.ID Where [b]true[/b]" But that solution is *ugly* |