日期:2014-05-16 浏览次数:20839 次
1)联表查询: ?1.? $sql = "select COUNT(*) rcnt from 统计表结构相同的三个表的数据总和。 ? 2.???$sql = "select * from 查询表结构相同的三个表的数据集合并按game_id号(此字段值必须唯一)倒序排序,并为每个表添加一个数值分别为1,2,3的自定义字段details 。 ? 2)时间戳转换 ????此情况适用与数据库中只有时间戳字段的时间类型,但是我们需要临时查询出此条数据的确切时间以便提供给需求方对照时间时。 ????SELECT * , from_unixtime( draw_time ) ? ??? 返回值:
??????????? (select * from game_details_1
??????????? union all
??????????? select * from game_details_2
??????????? union all
??????????? select * from game_details_3) tb";
??????????????? (select *,1 as details from game_details_1
??????????????? union all
??????????????? select *,2 as details from game_details_2
??????????????? union all
????????????????select *,3 as details from game_details_3) tb
??????????????? ORDER BY tb.game_id desc";
1. 在sql查询中将unix时间戳转化成data时间类型
????FROM `user_info`
????WHERE `passport` = 'wanluojie'
?????id ?? passport???? draw_time???? ?? from_unixtime(draw_time)
??? 17 ? wanluojie??? 1323771431?????2011-12-13 18:17:11
2.? 时间戳转换地址:
????http://tool.chinaz.com/Tools/unixtime.aspx