首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

mysql 两表之间的查询 各位大侠帮帮忙,该怎么处理

2012-01-09 
mysql 两表之间的查询 各位大侠帮帮忙有两张表 一张表 字段 id 和 name 另一张表 id 和 time(字段类型:dat

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 

热点排行