List:General Discussion« Previous MessageNext Message »
From:Gavin Towey Date:February 9 2010 7:08pm
Subject:RE: query help
View as plain text  
SELECT ID, check_no, amount FROM payables UNION SELECT ID, check_no, amount FROM paychecks;

Regards,
Gavin Towey


-----Original Message-----
From: Richard Reina [mailto:richard@stripped]
Sent: Tuesday, February 09, 2010 9:23 AM
To: mysql@stripped
Subject: query help

I am trying to write a query that merges 2 columns from different tables and show them as one column of data.  Something like the following.

payables
ID  |check_no| amount|
3   |3478    | 67.00 |
4   |3489    | 98.00 |
8   |3476    | 56.00 |

paychecks
ID  |check_no| amount
23  |3469    |498.00 |
34  |3502    |767.00 |
36  |3504    }754.00 |

I am struggling to write a select query that gives me amounts and check numbers from both of the tables in the same column.  Like the following:

ID  |check_no| amount|
3   |3478    | 67.00 |
4   |3489    | 98.00 |
8   |3476    | 56.00 |
23  |3469    |498.00 |
34  |3502    |767.00 |
36  |3504    }754.00 |

Any help would be greatly appreciated.

Thanks,

Richard

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1


This message contains confidential information and is intended only for the individual named.  If you are not the named addressee, you are notified that reviewing, disseminating, disclosing, copying or distributing this e-mail is strictly prohibited.  Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any loss or damage caused by viruses or errors or omissions in the contents of this message, which arise as a result of e-mail transmission. [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA, FriendFinder.com
Thread
query helpRichard Reina9 Feb
  • RE: query helpGavin Towey9 Feb