sayth
sayth

Reputation: 7048

Excel SQL - Where clause incorect syntax

I have a table in Excel and I want to query Column J which in the table is called Questions for words matching some conditions.

So I have tried this syntax

Select * from TSO.RawData   where trademthstart > dateadd(month,-6,GETDATE())  order by row_date asc  WHERE Questions LIKE '%NRM%'

Which I got following this SO question https://stackoverflow.com/a/14290878/461887

However I get an error near where clause

Upvotes: 0

Views: 58

Answers (1)

huudooguuruu
huudooguuruu

Reputation: 26

Try this:

Select * from TSO.RawData   
where trademthstart > dateadd(month,-6,GETDATE())  
and Questions LIKE '%NRM%'
order by row_date asc

Seems the "order by row_date" should be placed after the filters (where, and). After Where, any other filters should start with AND.

Upvotes: 1

Related Questions