in reply to DBD::ODBC and TSQL
You might be better off taking a different approach with your SQL statement. Something along the lines of
SELECT GETDATE() as DateToday, GETDATE()-(365*8) as EightYearsAgo, count(OrderID) as OrderCount from Orders WHERE ShippedDate > (GETDATE()-(365*8)) - (GETDATE()-(365*6))
would be recognized as a query, though I am unclear as to the intent of the statement so I cannot guarantee that the statement is what you are looking for.
For multiple statments (DELETE followed by INSERT INTO followed by a SELECT, for example), I recommend using stored procedures. Grab a TSQL manual and page through the SELECT statement again -- it's pretty flexible.
Good Luck!
|
|---|