mysql - How to display data from both tables -


mysql> desc customer_delivery_loc; +---------------+--------------+------+-----+---------+----------------+ | field         | type         | null | key | default |          | +---------------+--------------+------+-----+---------+----------------+ | cust_loc_id   | int(11)      | no   | pri | null    | auto_increment | | customer_id   | int(11)      | yes  | mul | null    |                | | locality      | varchar(100) | yes  |     | null    |                | | area          | varchar(100) | yes  |     | null    |                | | address       | varchar(100) | yes  |     | null    |                | | city          | varchar(50)  | yes  |     | null    |                | | state         | varchar(50)  | yes  |     | null    |                | | phone_number  | bigint(20)   | yes  |     | null    |                | | +---------------+--------------+------+-----+---------+----------------+    mysql> desc vendor_home_delivery; +-----------+--------------+------+-----+---------+-------+ | field     | type         | null | key | default | | +-----------+--------------+------+-----+---------+-------+ | vendor_id | varchar(50)  | yes  | mul | null    |       | | locality  | varchar(100) | yes  |     | null    |       | | area      | varchar(100) | yes  |     | null    |       | | address   | varchar(100) | yes  |     | null    |       | | city      | varchar(50)  | yes  |     | null    |       | | state     | varchar(50)  | yes  |     | null    |       | +-----------+--------------+------+-----+---------+-------+ 

i have got 2 tables shown above

the area column common both tables .

from user interface area , phone_number passed .

how write query display data both tables based on phone_number , area ??

i tried way not sure , giving error

select c.phone_number  customer_delivery_loc c  c.area in (select locality , address , area vendor_home_delivery )  c.phone_number = '9848032919'; 

- mysql database error: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'where c.phone_number = '9848032919'' @ line 1

you need

and c.phone_number 

in place of

 c.phone_number 

in query.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -