query help

query help

am 09.02.2010 18:23:13 von Richard Reina

I am trying to write a query that merges 2 columns from different tables an=
d 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 num=
bers 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=3Dgcdmg-mysql-2@m.gmane.o rg

RE: query help

am 09.02.2010 20:08:02 von Gavin Towey

U0VMRUNUIElELCBjaGVja19ubywgYW1vdW50IEZST00gcGF5YWJsZXMgVU5J T04gU0VMRUNUIElE
LCBjaGVja19ubywgYW1vdW50IEZST00gcGF5Y2hlY2tzOw0KDQpSZWdhcmRz LA0KR2F2aW4gVG93
ZXkNCg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogUmlj aGFyZCBSZWluYSBb
bWFpbHRvOnJpY2hhcmRAcnVzaGxvZ2lzdGljcy5jb21dDQpTZW50OiBUdWVz ZGF5LCBGZWJydWFy
eSAwOSwgMjAxMCA5OjIzIEFNDQpUbzogbXlzcWxAbGlzdHMubXlzcWwuY29t DQpTdWJqZWN0OiBx
dWVyeSBoZWxwDQoNCkkgYW0gdHJ5aW5nIHRvIHdyaXRlIGEgcXVlcnkgdGhh dCBtZXJnZXMgMiBj
b2x1bW5zIGZyb20gZGlmZmVyZW50IHRhYmxlcyBhbmQgc2hvdyB0aGVtIGFz IG9uZSBjb2x1bW4g
b2YgZGF0YS4gIFNvbWV0aGluZyBsaWtlIHRoZSBmb2xsb3dpbmcuDQoNCn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