Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005

    Unanswered: Problem with Select Statement

    Hello Everybody,

    Would you please help me writing the select statement with respect to the following scenario:

    Table Name: EGTVSCR



    The above table contains subscriptions for a particular service. Whenever a new subscription is issued, a new record is added to the above table with RECSTA = 'E'. If a user already has a previous subscription, all his RECSTA will become 'R' and the newly added record with RECSTA = 'E'. My goal is to fetch all the UserIDs that are getting expired between two dates say @Date1 and @Date2.

    I need to select all the UserIDs with any RECSTA value where EXPIRY_DATE is between @Date1 and @Date2 AND the user should not have any record with (EXPIRY_DATE > @Date2 and RECSTA = 'E') because this condition means a user did not renew his subscription so he should appear as expiring user.


  2. #2
    Join Date
    Apr 2006
    Provided Answers: 11
    have you already some sql - if so : please publish and some sample data...
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5-V11 Fundamentals- DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts