Monday, 7 January 2013

ms access date diffrence

1.--

where HISDATA1.DDATE between DateSerial( [select top 1 Year( HISDATA1.DDATE)  from HISDATA1 group by HISDATA1.DDATE order by HISDATA1.DDATE desc],1,1)
and DateSerial([select top 1 Year(HISDATA1.DDATE)  from HISDATA1 group by HISDATA1.DDATE order by HISDATA1.DDATE desc],12,31)


2.--

SELECT HISDATA1.DDATE
FROM HISDATA1
where HISDATA1.DDATE between
DateAdd("yyyy",-10,DateSerial((select top 1 Year( HISDATA1.DDATE)  from HISDATA1 group by HISDATA1.DDATE order by HISDATA1.DDATE desc),1,1) )
and
DateAdd("yyyy",-10,DateSerial((select top 1 Year( HISDATA1.DDATE)  from HISDATA1 group by HISDATA1.DDATE order by HISDATA1.DDATE desc),12,31) )
order by HISDATA1.DDATE desc

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...