Thanks if in case if we dont have the Item field in the Table B. wat to do..I 
know the primary key to connect both the tables/

----- Original Message ----- 
  From: ViSolve DB Team 
  To: Renish ; mysql@lists.mysql.com 
  Sent: Monday, November 27, 2006 12:48 PM
  Subject: Re: MySql doubt.


  Hi Renish,

  Here's the answer for your query.

  mysql> select * from a;
  +--------+
  | item   |
  +--------+
  | book   |
  | pencil |
  | table  |
  | chair  |
  +--------+

  mysql> select * from b;
  +--------+-----------+
  | item   | price     |
  +--------+-----------+
  | pencil | 11 dollar |
  | book   | 12 dollar |
  +--------+-----------+

  You can use this query to get  the items which doesnt have price. 

  mysql> select item from a where item not in ( select item from b);
  +-------+
  | item  |
  +-------+
  | table |
  | chair |
  +-------+

  Thanks,
  ViSolve DB Team.

  ----- Original Message ----- 
  From: "Renish" <[EMAIL PROTECTED]>
  To: <mysql@lists.mysql.com>
  Sent: Monday, November 27, 2006 8:45 AM
  Subject: MySql doubt.


  > Hi Guys,
  > 
  > I have an easy doubt..
  > 
  > Table A consist of  field Item and Table B consist of field Price. Table A 
  > consists of Items which has price aswell the items which doesnt have price. 
  > But In Table B,I have kept only the item which has price . Now, I want to 
  > subtract the total items in Table A to the total items in Table B. so I get 
  > the items which doesnt have price. I used union its not working.. can any 
of 
  > u guys write the code for it,,,
  > 
  > For example
  > 
  > Table A
  > Item    Book
  >           Pencil
  >            Table
  > Table B- which consists of Item with price
  > 
  > Price -Book-11 dollar
  >           Pencil-2 dollar
  > 
  > Please reply me asap. I hope it should be v. easy enough to tackle.
  > 
  > Cheers,
  > Renish koshy
  > 
  > 
  > -- 
  > MySQL General Mailing List
  > For list archives: http://lists.mysql.com/mysql
  > To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
  > 

Reply via email to