Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Can I union these Mysql query roslan I have these tables: client(idclient, name, reference) address(idaddress, idclient) inv(idinvoice, idaddress, total, datetime) payment(idpayment, idinvoice, amount, pdatetime) INTO something like client reference time idinvoice idpayment amount xyz a2345 2010-03-01 2342 NULL -(amount) xyz a2345 2010-02-12 2341 NULL -(amount) xyz a2345 2010-03011 NULL 2222 amount inv.total as amount, datetime and pdatetime as time, where idaddress = 9
No, a UNION statement is used to append similar rows from multiple tables. To get the output you want you would need to do a JOIN, however, I don't see the idclient column in the inv or payment tables. roslan
inv connected to address to client, payment connected to inv My output will be client reference idinvoice idpayment amount I inserted some sample data above, but on posting, it strays into another column. The sequence is right though. inv.total is to be in the same column as payment.amount AS amount negative. datetime and pdatetime under same column as time.