2

我的 Sql 查询是

select BookingDate from EntBookings 
where BookingDate between '01 Jan 2013' and '03 jan 2013'

我想输出列

1-jan  |  2-Jan  |  3-Jan 
4

1 回答 1

0

您的日期格式错误。利用

select case when BookingDate = '2013-01-01' then BookingDate end as '1-jan',
            when BookingDate = '2013-01-02' then BookingDate end as '2-jan',
            when BookingDate = '2013-01-03' then BookingDate end as '3-jan'
from EntBookings 
where BookingDate between '2013-01-01' and '2013-01-03'
于 2013-10-18T05:17:46.107 回答