Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have dateTime column in my database named as Login_date. i want to retrieve day,month and year with different names. like month named as date_month, year should be named as date_year, and day should be named as date_day..


for ex..
SQL
select product_name,month(bid_closing_time),day(bid_closing_time),year(bid_closing_time) from bidding_products


i am trying like below.. but not working.
Posted
Updated 19-Apr-22 4:44am
Comments
Herman<T>.Instance 14-Oct-13 6:15am    
did you read this? use alias

Check this
 
Share this answer
 
Hi,

please check the below if works:

SQL
SELECT product_name,YEAR(bid_closing_time) AS [date_year],MONTH(bid_closing_time) AS [date_month],DAY(bid_closing_time) AS [date_day],bid_closing_time
FROM bidding_products
 
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