现有如下两表:
table1:
id,name
1,test1
2,test2
3,test3
table2
id,tid,status,dateline
1,1,0,1378339200
2,1,1,1378339200
3,1,2,1378339200
2,2,1,1378339200
其中table2中tid为table1中id外键,status为为tbale1中每条数据不同时间的状态。
查询如下:
id name status0 dateline0 status1 dateline1 status2 dateline2
该如何查询