From mallah@trade-india.com Thu Apr 11 14:01:00 2002 Received: from trade-india.com (unknown [130.94.20.28]) by postgresql.org (Postfix) with SMTP id A187F476952 for ; Thu, 11 Apr 2002 10:01:00 -0400 (EDT) Received: (qmail 15595 invoked from network); 11 Apr 2002 14:13:12 -0000 Received: from ptil-235-129-del.primus-india.net (HELO trade-india.com) (203.196.129.235) by 130.94.22.209 with SMTP; 11 Apr 2002 14:13:12 -0000 Message-ID: <3CB597EC.6AE67F76@trade-india.com> Date: Thu, 11 Apr 2002 19:34:28 +0530 From: Rajesh Kumar Mallah X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: PostgResql SQL Mailing List Subject: using output of a subselect in LIKE/ILIKE Content-Type: multipart/alternative; boundary="------------A7FAC727E4D9BD82BBB7D9E0" X-Archive-Number: 200204/134 X-Sequence-Number: 7399 --------------A7FAC727E4D9BD82BBB7D9E0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi folks, I need to do something like : SELECT branch from branches where outstation like SELECT city from users join personal_account_details using(userid) where email='ratans@cal.vsnl.com' The above does not work for obvious reasons , but can anyone help me with the right SQL? regds Rajesh Kumar Mallah. --------------A7FAC727E4D9BD82BBB7D9E0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi  folks,

I need to do something like :

SELECT  branch from  branches
where outstation like
SELECT  city from users  join personal_account_details
using(userid)  where email='ratans@cal.vsnl.com'

The above does not work for obvious reasons , but can anyone help me
with the right SQL?
 

regds
Rajesh Kumar Mallah.
 
 
  --------------A7FAC727E4D9BD82BBB7D9E0-- From jeff_eckermann@yahoo.com Thu Apr 11 14:48:07 2002 Received: from web20804.mail.yahoo.com (web20804.mail.yahoo.com [216.136.226.193]) by postgresql.org (Postfix) with SMTP id BCE8A47702E for ; Thu, 11 Apr 2002 10:48:07 -0400 (EDT) Message-ID: <20020411144818.39555.qmail@web20804.mail.yahoo.com> Received: from [68.14.98.218] by web20804.mail.yahoo.com via HTTP; Thu, 11 Apr 2002 07:48:18 PDT Date: Thu, 11 Apr 2002 07:48:18 -0700 (PDT) From: Jeff Eckermann Subject: Re: using output of a subselect in LIKE/ILIKE To: Rajesh Kumar Mallah , PostgResql SQL Mailing List In-Reply-To: <3CB597EC.6AE67F76@trade-india.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200204/137 X-Sequence-Number: 7402 SELECT branch from branches where outstation like (SELECT city from users join personal_account_details using(userid) where email='ratans@cal.vsnl.com') || '%' --- Rajesh Kumar Mallah wrote: > Hi folks, > > I need to do something like : > > SELECT branch from branches > where outstation like > SELECT city from users join > personal_account_details > using(userid) where email='ratans@cal.vsnl.com' > > The above does not work for obvious reasons , but > can anyone help me > with the right SQL? > > > regds > Rajesh Kumar Mallah. > > > > __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ From mallah@trade-india.com Thu Apr 11 15:14:17 2002 Received: from mail-relay.trade-india.com (unknown [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 94F6C477230 for ; Thu, 11 Apr 2002 11:14:17 -0400 (EDT) Received: (qmail 13780 invoked from network); 11 Apr 2002 15:20:59 -0000 Received: from system11.trade-india-local.com (HELO trade-india.com) (192.168.0.11) by ptil-236-129-del.primus-india.net with SMTP; 11 Apr 2002 15:20:59 -0000 Message-ID: <3CB5A920.9E5B95D7@trade-india.com> Date: Thu, 11 Apr 2002 20:47:52 +0530 From: Rajesh Kumar Mallah X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: Jeff Eckermann Cc: PostgResql SQL Mailing List Subject: Re: using output of a subselect in LIKE/ILIKE References: <20020411144818.39555.qmail@web20804.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200204/139 X-Sequence-Number: 7404 thanks Jeff it worked ! after adding a '%' || after LIKE though :-) WORKING SQL: SELECT branch from branches where outstation ilike '%' || (SELECT city from users join personal_account_details using(userid) where email='ratans@cal.vsnl.com') || '%'; Jeff Eckermann wrote: > SELECT branch from branches > where outstation like > (SELECT city from users join > personal_account_details > using(userid) where email='ratans@cal.vsnl.com') || > '%' > > --- Rajesh Kumar Mallah > wrote: > > Hi folks, > > > > I need to do something like : > > > > SELECT branch from branches > > where outstation like > > SELECT city from users join > > personal_account_details > > using(userid) where email='ratans@cal.vsnl.com' > > > > The above does not work for obvious reasons , but > > can anyone help me > > with the right SQL? > > > > > > regds > > Rajesh Kumar Mallah. > > > > > > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org