我有这样一张桌子:
| date | example_variable |
| 2013-2-22 | cat |
| 2013-3-22 | dog |
| 2013-1-22 | ewe |
| 2013-8-22 | pig |
Run Code Online (Sandbox Code Playgroud)
我已经知道该怎么做:
SELECT
a.example_variable as V1,
b.example_variable as V2,
c.example_variable as V3,
a.AsOfDate as 1stDate,
b.AsOfDate as 2ndDate,
c.AsOfDate as 3rdDate
FROM <table> a, <table> b, <table> c
WHERE a.AsOfDate = '2013-1-22'
AND b.AsOfDate = '2013-2-22'
AND c.AsOfDate = '2013-3-22'
Run Code Online (Sandbox Code Playgroud)
输出如下:
| V1 | V2 | V3 | 1stDate | 2ndDate | 3rdDate |
| …Run Code Online (Sandbox Code Playgroud)