1 11830 Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #1 我在SQL 数据库中有一个tableabc表,有3个日期时间字段t1,t2,t3, 现在我想查询这3个字段的所有时间,显示成一个列并按时间排序,请 问如何做?
J jrq Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #2 select * from tableabc where (time>t1 and time<t2) or (time>t2 and time<t3) 自动排序 ---------行吗?
select * from tableabc where (time>t1 and time<t2) or (time>t2 and time<t3) 自动排序 ---------行吗?
1 11830 Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #3 这样会出现3列,我要的是一列,将t2放到t1后面,t3放到t2的后面,然后再排序
L lujr Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #4 请试一试: (select t1 from tableabc group by t1) union (select t2 from tableabc group by t2) union (select t3 from tableabc group by t3)
请试一试: (select t1 from tableabc group by t1) union (select t2 from tableabc group by t2) union (select t3 from tableabc group by t3)
1 11830 Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #5 lujr的方法可以,可是如果日期时间如果有一样的就只显示一条,能不能都显示。
C czlucky Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #9 (select t1 from table) as tmp1 union all (select t2 from table) as tmp2 ...
K Kisber Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #10 select dinstinct t from ( select t1 as t from tableabc union select t2 as t from tableabc union select t3 as t from tableabc) as tablex order by t
select dinstinct t from ( select t1 as t from tableabc union select t2 as t from tableabc union select t3 as t from tableabc) as tablex order by t
L lujr Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #12 TO 11830: 把UNION改成UNION ALL................
1 11830 Unregistered / Unconfirmed GUEST, unregistred user! 2002-01-09 #14 谢谢大家,我还有几个问题在 http://www.delphibbs.com/delphibbs/dispq.asp?lid=845478 这里,请帮我看一下谢谢!