Re: How to find out common records with Where clause

From: Steve Howard <stevedhoward_at_gmail.com>
Date: Fri, 9 Jan 2009 06:06:54 -0800 (PST)
Message-ID: <26a9e5ab-d288-4cfd-9996-3b13836a44bf_at_q30g2000prq.googlegroups.com>



On Jan 9, 7:08 am, Sanjeev <sanjeev.atvan..._at_gmail.com> wrote:
> Dear Gurus,
>
> I have "VISITOR" table as follows.
>
> VisitNo  EmpName   Address
> --------------------------------------------
> 1           Sanjeev       Mumbai
> 2           Rajeev         New-Mumbai
> 3           Shailesh      Mumbai
> 4           Ramesh      New-Mumbai
>
> 5           Sanjeev       Pune-1
> 6           Rajeev         Pune-2
> 7           Shailesh      Pune-3
> 8           Shreyas      Pune-4
>
> 9           Sanjeev       Delhi
> 10         Rajeev         New-Delhi
> 11         Shailesh      Delhi
> 12         Shreyas      New-Delhi
>
> If I give location as Mumbai, Pune and Delhi i.e. location based
> pattern matching (LIKE operator) then
> query should retrieve record as Sanjeev,Rajeev and Shailesh
> i.e.
> all employees those are present in all given locations (Mumbai, Pune
> and Delhi).
> query shouldn't retrieve Ramesh, Shreyas because they are not present
> in all given location.
>
> I tried with "OR" operator but it did not work.
>
> Could any one help me in above.
>
> Thanking in advance
> Sanjeev

Hi Sanjeev,

Can you post what you have already tried, including DDL for the table creates?

Regards,

Steve Received on Fri Jan 09 2009 - 08:06:54 CST

Original text of this message