Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql query help

Author  Topic 

w1102157
Yak Posting Veteran

80 Posts

Posted - 2012-04-04 : 04:44:38
Hi Guys,

need help on a task i am doing , i need to know how do i do a query to extract data from a table where the apointment date is greater then the createdate?

for example


id name address createddate appointmentdate
1 a bb 01/01/2012 01/02/2012
2 b cc 10/02/2012 05/02/2012
3 c dd 11/02/2012 01/02/2012
4 d ee 20/02/2012 01/03/2012


from the above the out put would be

id name address createddate appointmentdate
1 a bb 01/01/2012 01/02/2012
4 d ee 20/02/2012 01/03/2012

i would be greatful for any help provided

thank you

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-04 : 04:50:13
[code]
select *
from yourtable
where appointmentdate > createdate
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sql-programmers
Posting Yak Master

190 Posts

Posted - 2012-04-04 : 04:50:32
It may help ..

SELECT ID, NAME, ADDRESS, CREATEDDATE, APPOINTMENTDATE
FROM TABLE1 WHERE CREATEDDATE < APPOINTMENTDATE

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page
   

- Advertisement -