Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Help

Status
Not open for further replies.

rawatds

Programmer
Jun 3, 2004
30
SG
Hi All,
I have a requirement where i need to provide a SQL statement
to front application.

Code:
 The data is like 
        Login_id     Login_group     Expiry_date
          100             1            23-DEC-2010
          101             1            23-DEC-2010
          102             1            26-NOV-2010
          10001           2            23-DEC-2010
          10002           2            23-DEC-2010
          10003           3            23-DEC-2010
          10004           4            23-DEC-2010
  
 The Result should be like that 
          Login_id     Login_group     Expiry_date
          10001           2            23-DEC-2010
          10002           2            23-DEC-2010
          10003           3            23-DEC-2010
          10004           4            230DEC-2010

Only those records in a Single ( Login_group ) should return
where all Login_id are expiry on 23-DEC-2010

The Login_id 100,101, 102 should all exclude from the SQL result as 102 is not Expiry on 23-DEC-2009 so all Records with login_group 1 are Excluded.

In Short Only those records should be return where all records in same Login_group are Expired on 23-DEC-2010.

Any hint is Welcome.

Thanks
 
I think i got it :
I can Select all Group where any Ids are having expiry_date not equal to 23-DEC-2010 and then use this as a Subquery
Code:
   select * from table where group_id not in 
      ( SubQuery )
 
I think i got it
It is bad manners to get a solution from a different forum and then post it here as yours. You should also probably acknowledge the people who helped you on the other forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top