Page 1 of 1

query to show difference of table A and table b.

Posted: Fri Apr 24, 2009 1:39 am
by monindra1984
Dear frends,

there are two TABLE A (CUSTOMER_ID) and TABLE B (CUSTOMER_ID,ITEM1,ITEM2,...,ITEM36). Table A stores the permanent customers names. Table B keeps the demand places by any customer in Table A..

I wanted to find out which customers_id only who have not placed demand for items. I was trying do it by Left Join but i cound't...

pls guys help me out.. I m not good at database MYSQL. I want the query for MYSQL.

Thanks with anticipation

Monindra Masia

Re: query to show difference of table A and table b.

Posted: Fri Apr 24, 2009 2:23 am
by susrisha

Code: Select all

 
SELECT DISTINCT customer_id
FROM tbl_customer1
WHERE (
customer_id
) NOT 
IN (
 
SELECT customer_id
FROM tbl_customer2
 
You may replace the table names..

i have renamed Table A to tbl_customer1 and Table B to tbl_customer2.