pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
using output of a subselect in LIKE/ILIKE
3+ messages / 2 participants
[nested] [flat]

* using output of a subselect in LIKE/ILIKE
@ 2002-04-11 14:04  Rajesh Kumar Mallah <mallah@trade-india.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rajesh Kumar Mallah @ 2002-04-11 14:04 UTC (permalink / raw)
  To: pgsql-sql

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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: using output of a subselect in LIKE/ILIKE
@ 2002-04-11 14:48  Jeff Eckermann <jeff_eckermann@yahoo.com>
  parent: Rajesh Kumar Mallah <mallah@trade-india.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Jeff Eckermann @ 2002-04-11 14:48 UTC (permalink / raw)
  To: Rajesh Kumar Mallah <mallah@trade-india.com>; pgsql-sql

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 <mallah@trade-india.com>
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/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: using output of a subselect in LIKE/ILIKE
@ 2002-04-11 15:17  Rajesh Kumar Mallah <mallah@trade-india.com>
  parent: Jeff Eckermann <jeff_eckermann@yahoo.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Rajesh Kumar Mallah @ 2002-04-11 15:17 UTC (permalink / raw)
  To: Jeff Eckermann <jeff_eckermann@yahoo.com>; +Cc: pgsql-sql


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 <mallah@trade-india.com>
> 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-04-11 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-11 14:04 using output of a subselect in LIKE/ILIKE Rajesh Kumar Mallah <mallah@trade-india.com>
2002-04-11 14:48 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
2002-04-11 15:17   ` Rajesh Kumar Mallah <mallah@trade-india.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox