读书人

mysql 两表之间的查询 各位大侠帮帮忙

发布时间: 2012-01-09 21:05:42 作者: rapoo

mysql 两表之间的查询 各位大侠帮帮忙
有两张表 一张表 字段 id 和 name 另一张表 id 和 time(字段类型:datetime)
查询结果 有姓名和时间 排列方式是以离今日最近的日期排序

大家帮帮忙~~~急

[解决办法]
select name, time
from table1, table2
where table1.id = table2.id
order by time desc;
[解决办法]

SQL code
SELECT name, time FROM table1, table2WHERE table1.id = table2.idORDER BY time DESC
[解决办法]
探讨

SQL code

SELECT name, time FROM table1, table2
WHERE table1.id = table2.id
ORDER BY time DESC

[解决办法]
探讨

select name, time
from table1, table2
where table1.id = table2.id
order by time desc;

[解决办法]
SQL code
   select A.name , B.time  from  table1 A ,table2 B    where  A.id = B.id   order by timestampdiff(second,now(),B.time) asc 

读书人网 >J2SE开发

热点推荐