Which mysql join will be applicable?
Posted: Wed Sep 12, 2012 4:33 am
Hi there,
As I always get confused of mysql join. Here are my descriptions:
I have two tables
Table: price
==============================
ID || company || volume || price
------------------------------------------
01 || comp-A || 300000 || 500
------------------------------------------
02 || comp-B || 260000 || 400
------------------------------------------
03 || comp-C || 300000 || 450
------------------------------------------
04 || comp-D || 280000 || 500
------------------------------------------
05 || comp-E || 275000 || 400
-----------------------------------------
06 || comp-F || 290000 || 450
=============================
Table: type_of_company
===================================
ID || company || comp_type || country
-------------------------------------------------
01 || comp-A || Transport || Canada
-------------------------------------------------
02 || comp-B || Oil & Lubri || Brazil
-------------------------------------------------
03 || comp-C || Transport || India
------------------------------------------------
04 || comp-D || Transport || USA
------------------------------------------------
05 || comp-E || Courier || Bangladesh
------------------------------------------------
06 || comp-F || Transport || Jermany
==================================
user of my website will check which company are of 'Transport' type and their share volume and price. They will select company type from a drop-down menu and after pressing 'SUBMIT' menu, they will see this page:
Type of company: Transport
=========================
Company || Price || Volume
=========================
comp-A || 500 || 300000
----------------------------------
comp-C || 450 || 300000
----------------------------------
comp-D || 500 || 280000
----------------------------------
comp-F || 450 || 290000
=========================
which mysql join/query should use in this case?
Expecting a help from all expert member.
Regards
As I always get confused of mysql join. Here are my descriptions:
I have two tables
Table: price
==============================
ID || company || volume || price
------------------------------------------
01 || comp-A || 300000 || 500
------------------------------------------
02 || comp-B || 260000 || 400
------------------------------------------
03 || comp-C || 300000 || 450
------------------------------------------
04 || comp-D || 280000 || 500
------------------------------------------
05 || comp-E || 275000 || 400
-----------------------------------------
06 || comp-F || 290000 || 450
=============================
Table: type_of_company
===================================
ID || company || comp_type || country
-------------------------------------------------
01 || comp-A || Transport || Canada
-------------------------------------------------
02 || comp-B || Oil & Lubri || Brazil
-------------------------------------------------
03 || comp-C || Transport || India
------------------------------------------------
04 || comp-D || Transport || USA
------------------------------------------------
05 || comp-E || Courier || Bangladesh
------------------------------------------------
06 || comp-F || Transport || Jermany
==================================
user of my website will check which company are of 'Transport' type and their share volume and price. They will select company type from a drop-down menu and after pressing 'SUBMIT' menu, they will see this page:
Type of company: Transport
=========================
Company || Price || Volume
=========================
comp-A || 500 || 300000
----------------------------------
comp-C || 450 || 300000
----------------------------------
comp-D || 500 || 280000
----------------------------------
comp-F || 450 || 290000
=========================
which mysql join/query should use in this case?
Expecting a help from all expert member.
Regards