我有三个表,列相同,但数据不同(存款、取款、转账)
如果不存在,则创建表
withdrawals
(
id
int(11)
空自动增量,
user
varchar(12)默认为空,
amount
double(12,2)默认为空,
date
时间戳空默认值
当前时间戳,
time
varchar(50)默认为空,
type
varchar(50)默认为空,
status
varchar(1)默认值“0”,
notes
主键
(
身份证件
))引擎=myisam默认值
charset=latin1 auto_increment=1;
我希望将所有3个表合并为1个表,并按所有日期对其排序,并且仅当user=$user'时才显示行
Example if table 1 has this data
id user amount date time type status notes
2 vveer 142.00 2010-04-01 03:05:01 PayPal 2 deposit
3 test11 116.00 2010-04-01 10:33:23 PayPal 2 deposit
Example if table 2 has this data
id user amount date time type status notes
3 vveer 142.00 2009-04-01 03:05:01 PayPal 2 withdraw
7 test11 112.00 2010-04-12 10:33:23 PayPal 2 withdraw
Example if table 3 has this data
id user amount date time type status notes
5 test11 133.00 2010-03-01 10:33:23 PayPal 2 transfer
7 test11 123.00 2010-02-01 10:33:23 PayPal 2 transfer
I want to show all data for user test11 ordered by dates(is like putting all the dates together and ordering by 1 date column ) .
3 test11 112.00 2010-04-12 10:33:23 PayPal 2 withdraw
7 test11 116.00 2010-04-01 10:33:23 PayPal 2 deposit
5 test11 133.00 2010-03-01 10:33:23 PayPal 2 transfer
5 test11 123.00 2010-02-01 10:33:23 PayPal 2 transfer