Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 To: mk sharma
  Where is mk sharma?
 mumbai
 India
 mk sharma
 Tags
Subject: RE: Select Sql
Thread ID: 416083 Message ID: 416092 # Views: 40 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Sunday, December 21, 2014 12:12:33 PM         
   


> > That looks as if you want an "And" condition instead of the implicit "Or"?
> >
> >
> > Select * From junk1 Where film_id In (Select film_id From junk1 Where person_id = 45) And film_id In (Select film_id From junk1 Where person_id = 38)
> > 

> >
> >
> >
> > hth
> > -Stefan
> >
> >
>
> Thank you,
> Perfect!
>
> Is this possible with Single Select Sql, without "In" clause or with Single "In" clause ?
>
>
> Warm Regards,
> mk.

Just for fun, two alternatives. Still with 'in' :-)
To reduce the "in", person_id In(45, 38) can be replaced with person_id = 45 or person_id = 38

Select junk1.* From junk1,(SELECT film_id FROM junk1 WHERE person_id In(45, 38) GROUP BY 1 HAVING COUNT(distinct person_id) =2) a WHERE junk1.film_id=a.film_id

Select * From junk1 WHERE film_id in (SELECT film_id FROM junk1 WHERE person_id In(45, 38) GROUP BY 1 HAVING COUNT(distinct person_id) =2)


Respectfully

ENTIRE THREAD

Select Sql Posted by mk sharma @ 12/21/2014 6:32:43 AM
RE: Select Sql Posted by Stefan Wuebbe @ 12/21/2014 6:53:37 AM
RE: Select Sql Posted by mk sharma @ 12/21/2014 7:02:21 AM
RE: Select Sql Posted by Stefan Wuebbe @ 12/21/2014 7:41:31 AM
RE: Select Sql Posted by mk sharma @ 12/21/2014 8:10:07 AM
RE: Select Sql Posted by Vilhelm-Ion Praisach @ 12/21/2014 12:12:33 PM
RE: Select Sql Posted by mk sharma @ 12/21/2014 5:24:53 PM
RE: Select Sql Posted by Anders Altberg @ 12/21/2014 10:58:37 PM