Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
satishkurra
Specialist II
Specialist II

Join condition syntax error

     Hi

Help needed in below join condition. Throwing syntax error. Please help...

LOAD *,

  month([OrderDate]) as OrderMonth,

  year([OrderDate])as OrderYear;

SQL SELECT

  CustomerID,

  Sales_SalesOrderHeader.SalesOrderID as SalesOrderID,

  Sales_SalesOrderHeader.SalesPersonID     as SalesPersonID,

  TerritoryID,

  AccountNumber,

  OrderDate,

  CreditCardApprovalCode,

  SubTotal,

  TaxAmt,

  TotalDue,

  ProductID,

  OrderQty

    FROM Sales_SalesOrderDetail

    JOIN Sales_SalesOrderHeader

    ON Sales_SalesOrderDetail.SalesOrderID = Sales_SalesOrderHeader.SalesOrderID

    $(WHERE);

6 Replies
maxgro
MVP
MVP

which error do you get?

maybe the WHERE? is it a variable?

'$(WHERE)';



or a missing space here

year([OrderDate])as

satishkurra
Specialist II
Specialist II
Author

Hi

Please find attached the screen shot for error and script i'm using

You are correct For Where i'm passing variable....

satishkurra
Specialist II
Specialist II
Author

Any update guys....

JonnyPoole
Employee
Employee

does the SQL syntax work outside QlikView.  I often see 'INNER JOIN' instead of just 'JOIN' in native SQL , but it depends what the driver accepts.

If you remove the join (and extra fields)  and just do a from <table> and where <condition>  (so remove the join) do you get the error ?

maxgro
MVP
MVP

you can try

- first without where; does it works?

- if yes without the date, does it works

to identify the wrong part

petter
Partner - Champion III
Partner - Champion III

MS Access use the Jet Engine which use the hash # for any date literal - so you will have to change the single quotes into hashes - like this:

.......

        OrderDate IN ( #2001-07-01 12:00:00 AM# , #2001-07-02 12:00:00 AM# ..........  ) 

;