mysql - select one column from one table and other columns from another table -
i have tables :
1. users : user_id, user_name 2. transaction : user_id, transaction_number, transaction_date
i want user_id, transaction_number, transaction_date particular transaction_date. first table may contain repeated user_id different dates , may not contain user_id particular date. result must contain user_ids , transaction_number , transaction dates null if user_id has no transaction entries in transaction table.
for example :
user_id transaction_number transaction_date 1 10 12/04/2013 2 0 12/04/2013 3 0 12/04/2013
it shows there 3 users , user_id 1 have transaction in 12/04/2013.
select * transaction right outer join users on transaction.user_id = users.user_id , transaction.transaction_date = 'apr 12 2013 12:00am'
Comments
Post a Comment