经过一个简单的查询...
SELECT Col_ID, datetime1, datetime2, datetime3
FROM TABLE_DATETIME
WHERE datetime1 LIKE '20130805%'
OR datetime2 LIKE '20130805%'
OR datetime3 LIKE '20130805%'
...我有这种情况
Col_ID |datetime1 |datetime2 |datetime3 |
----------|--------------|--------------|--------------|
40302025 |20130805123022|NULL |NULL |
40302028 |20130805180055|NULL |NULL |
40302030 |NULL |20130805090055|NULL |
40302055 |NULL |20130805190055|NULL |
40302074 |NULL |NULL |20130805070055|
现在,在同一个先前的查询中,我想将 datetime1、datetime2、datetime3 合并到一个列中,我们将其称为“ALL_DATETIME”,然后按此排序以获得此结果...
Col_ID |ALL_DATETIME |
----------|--------------|
40302074 |20130805070055|
40302030 |20130805090055|
40302025 |20130805123022|
40302028 |20130805180055|
40302055 |20130805190055|