At the bottom of this post is a SQL statement that returns data to an Excel spreadsheet.
Some of the column headings that are displayed in Excel need to be changed. Specifically:
1) User_Date_1 to 1st Curt Date
2) User_Numeric_1 to 1st Curt Amt
3) User_Date_2 to 2nd Curt Date
4) User_Numeric_2 to 2nd Curt Amt
5) User_Date_3 to 3rd Curt Date
6) User_Numeric_3 to 3rd Curt Amt
I'm new to SQL and it's syntax. I've tried (on line 20) the following change:
vdd.User_Date_1 as 1st Curt Date
This results in a syntax error. I don't know what the "vdd" at the start of that line means, cut am assuming this might be the reason for the syntax error.
when 'D' then 'Demo'
when 'O' then 'On-Hold'
when 'L' then 'On-Loan'
when 'R' then 'Rental'
when 'G' then 'Sold not Invoiced'
when 'A' then 'Asset'
when 'I' then 'Invoiced'
when 'S' then 'Stock'
Else if VhStock.Stock_Status = 'P' then 'Pending' else 'In-Stock' endif
VhStock.FLOORVAL as FloorPlan,
LEFT JOIN VhStock_DealerDefined vdd ON (vdd.Stock_No = VhStock.NO)
WHERE (MONTH(vdd.User_Date_1) = 8 AND YEAR(vdd.User_Date_1) = 2015)
OR (MONTH(vdd.User_Date_2) = 8 AND YEAR(vdd.User_Date_2) = 2015)
OR (MONTH(vdd.User_Date_3) = 8 AND YEAR(vdd.User_Date_3) = 2015);