-2

我试图做一个依赖于结果的 SQL 查询只返回一列,我有下一张表:

 day1       | day2       | day3
 -------------------------------------
 2013-02-25 | 2013-02-26 | 2013-02-27

所以我希望下一个查询只返回一天的行,

 SELECT * FROM days WHERE day1 = '2013-02-25' or day2 = '2013-02-25' or day = '2013-02-25'

我想要下一个,只有具有价值的行。

day        |
------------
2013-02-25 |
4

1 回答 1

0

尝试这个:

SELECT day1 AS TheDay FROM days WHERE day1 = '2013-02-25' 
UNION 
SELECT day2           FROM days WHERE day2 = '2013-02-25' 
UNION
SELECT day3           FROM days WHERE day3 = '2013-02-25'
于 2013-02-24T09:27:42.243 回答