[英]SQL date comparison on sql
need help in getting this logic side by side. 需要帮助来使这种逻辑并存。 I am using 3 fields in a table. 我在表中使用3个字段。
Select Year, Date, Revenue from Sale
The result will be like this 结果将是这样
Year Date Revenue
2014 01/02/2014 500
2013 01/02/2013 250
2014 02/02/2014 750
2013 02/02/2013 250
Here is what I need to display 这是我需要显示的
2014 01/02/2014 500 2013 01/02/2013 250
2013 02/02/2014 750 2013 02/02/2013 250
The one we need to show should display in 4 columns. 我们需要显示的那个应该显示在4列中。 I tried some self join but it is cartesian product. 我尝试了一些自连接,但这是笛卡尔积。 Not sure it works. 不确定是否有效。 Please help me with this logic 请帮我这个逻辑
It seem like Pivot table, and you can try to do like this example : 看起来像数据透视表,您可以尝试执行以下示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.