Click here to Skip to main content
15,888,335 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
SQL
SELECT vm.RegistrationNo,
       OilChangeOdometer,
       OilChangeDate,
       ServicingOdometer,
       ServicingChangeDate,
       TyreChangeOdometer,
       TyreChangeDate,
       driverid,
       drivername,
       licenseexpiry,
       contact,
       vh.Insurancestartdate,
       vh.insuranceexpirydate,
       vh.insurancecompany
FROM   VehicleMaintance AS vm
       FULL OUTER JOIN
       vehicle_master AS vh
       ON vm.RegistrationNo = vh.RegistrationNo
WHERE  vm.RegistrationNo = @vehId
       AND ((OilChangeDate BETWEEN @strFromDt AND @strToDt)
            OR (ServicingChangeDate BETWEEN @strFromDt AND @strToDt)
            OR (TyreChangeDate BETWEEN @strFromDt AND @strToDt));




while selecting i need only the date part from only oilchangedateand not the time part. iam displaying it in an report ,so i need only the date part to be displayed not the time part pls edit and show in my query itself.
Posted
Updated 7-Dec-11 4:07am
v4

 
Share this answer
 
Comments
Amir Mahfoozi 7-Dec-11 10:35am    
+5 my 5 :)
Uday P.Singh 7-Dec-11 10:39am    
thanks Amir :)
Monjurul Habib 11-Dec-11 20:58pm    
5!
There are different ways to do this, one of the ways
SELECT CONVERT(VARCHAR(10),GETDATE(),103)

103 is for format dd/mm/yyyy
 
Share this answer
 
Comments
ashok_89 7-Dec-11 8:55am    
sir i need to have it within the select statement modify and show in my query
[no name] 7-Dec-11 9:56am    
Do it yourself. You have been given the answer, its up to you to implement. We are not here to do your work.
[no name] 7-Dec-11 10:08am    
i am agree with you.
ashok_89 7-Dec-11 23:54pm    
see Mark Nischalke and MaulikDusara if put the the qury iam getting the error this ans doesnt work,thats why i asked and i didnt asked u guys particularly
Hi,

Try this.

SQL
SELECT CAST(GETDATE() AS DATE)


With that, you will get the date only :)

Regards,
Eduard
 
Share this answer
 
Refer this link to display date part as per your need:

http://www.sql-server-helper.com/tips/date-formats.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900