我想使用sql查询以不同方式检索年,月和日 [英] i want to retrieve year , month and day differently using sql query
本文介绍了我想使用sql查询以不同方式检索年,月和日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的数据库中有dateTime列,名为Login_date。我想用不同的名字检索日,月和年。比如命名为date_month的月份,year应命名为date_year,day应命名为date_day ..
for ex ..
选择 product_name,month(bid_closing_time),day(bid_closing_time),year(bid_closing_time)来自 bidding_products
i我尝试下面但是没有工作。
解决方案
如果有效,请检查以下内容:
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
检查此
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..
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.
解决方案
Hi,
please check the below if works:
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
Check this
这篇关于我想使用sql查询以不同方式检索年,月和日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文