我在MySQL中有一个问题,做得对.但书籍代码略有不同.
书:
use tennis;
select playerno, datediff(coalesce(end_date, current_date),
begin_date) as Difference, position
from committee_members
where datediff(coalesce(end_date, current_date), begin_date) > 500
order by 1;
Run Code Online (Sandbox Code Playgroud)
1这个订单是什么?
我的代码也有效,几乎相同,除了:
select playerno, datediff(coalesce(end_date, current_date) AS Data,
order by Data;
Run Code Online (Sandbox Code Playgroud) 为什么有人想将列转换为行(即旋转)?它解决了哪个问题?
我找到了一些链接,但没有得到满意的答案.
http://codeghar.wordpress.com/2007/11/03/pivot-tables/
http://msdn.microsoft.com/en-us/library/ms177410%28SQL.105%29.aspx