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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.