mardi 14 avril 2015

i am trying to retrieve data of last month from table called test and date field called date what is the right sql syntex

1582 - Incorrect parameter count in the call to native function 'DATEDIFF'


I searched a lot but didn't find any working syntex of sql any help will be highly appreciated i typed following syntex but didn't work



select * from test
WHERE date >= DATEADD(mm,DATEDIFF(mm,0,GETDATE())-1,0)
AND date < DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)




Aucun commentaire:

Enregistrer un commentaire