Dear Friends,
 
I am using mysql 3.23.42. I want to execute one
query  to get specific result but not getting the
correct  result.
 
I have 2 tables named: ContactList and GroupList.
 
Their structure is as below:
 
 +-------------------------------+
           ContactList
 +-------------------------------+
 username varchar(15)   
 nickname varchar(15)
 primary key(username, nickname)
 
 +-----------------------------------------+
           GroupList
 +-----------------------------------------+
 username  varchar(15)  
 nickname  varchar(15)
 groupname varchar(15)
 primary key(username, groupname, nickname)
 
 
 - Table CotactList has following values:
 
 +------------------------+
  username      nickname
 +------------------------+
  gaurang        malay
  gaurang        viral
  gaurang        nilay
  gaurang        ajay
  gaurang        amit
  gaurang        raja
 
  
 - Table GroupList has following values:
 
 +----------------------------------------+
  username      groupname       nickname
 +----------------------------------------+
  gaurang        friend          malay
  gaurang        friend          viral
 
 
 - Now I want to get those 'nickname' from
  ContactList which do not appear in GroupList with  
  following condition:
        ContactList.username = 'gaurang'
        ContactList.username = GroupList.username
        groupname            = 'friend'
 
 - So as result of the query I should get following
 values:
        nilay
        ajay
        amit
        raja    
 
 - I executed following query, it gives result with
 MS-Access but as it uses inner query and mysql does
 not support it, it did not work with mysql:
        select nickname from ContactList where
 username='gaurang' and nickname not in (select
 nickname from GroupList where username='gaurang' and
 groupname='friend')
 
 - I also tried with following query but did not get
 the desired result:
        select cl.nickname from ContactList cl,
 GroupList gl where cl.username='gaurang' and
 cl.username=gl.username and gl.groupname='friend'
 and cl.nickname!=gl.nickname
 
 
 If anybody can help me in this problem I would be
 thankful to him.
 
 
 Thanks
 gaurang.
 


____________________________________________________________
Do You Yahoo!?
Send a newsletter, share photos & files, conduct polls, organize chat events. Visit 
http://in.groups.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to