Jump to content

how to extract data from different types of tables and use to generate reports


heshan

Recommended Posts

Hi guys,

 

I want to generate reports and i want to use some fields of one table and other fields of another table. How can i use that?

 

Ex.  customer(customer_id, full_name,name_with_initials, address, contact_number,gender)

 

      transaction_table(tran_ID, account_number,account_type,transaction_type, amount, Date)

 

 

If i want to use only customer_id, tran_ID, full_name and amount how can i use them to generate reports.

 

I want them to be taken as fields of one table and use it..

 

Thanks,

Heshan

Assuming that the 'account_number' field in the transaction table contains the customer_id of the customer making the transaction you can use a join (read Shp0ngi5's link for more information):

 

SELECT customer_id, tran_ID, full_name, amount FROM transaction_table LEFT JOIN customer ON transaction_table.account_number = customer.customer_id

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.