1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Don't display records if they are over a year old

Discussion in 'C#' started by Kyriakos, Sep 9, 2011.

  1. #1
    Hi,

    I have a date field in my database for my records and i want to disappear the records from my asp page if they are over a year old (365 days).

    How i can do this? The date field name is "trndate" and the date format in my database is like this "1/1/2011".

    Thank you in advance.
    SEMrush
     
    Kyriakos, Sep 9, 2011 IP
    SEMrush
  2. nepid7

    nepid7 Member

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    Hi,

    I don't know what database you are using, but if it is SQL Server then the query might be like this:

    select * from Table1 where trnDate>=getdate()-365;


    Hope I am right.:)
     
    nepid7, Sep 9, 2011 IP
  3. amkeabhi123

    amkeabhi123 Member

    Messages:
    219
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #3
    this is right query .
     
    amkeabhi123, Sep 12, 2011 IP
  4. Kyriakos

    Kyriakos Active Member

    Messages:
    155
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    thank you man. you are great.
     
    Kyriakos, Sep 14, 2011 IP
  5. RaviAuto

    RaviAuto Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    According to my view...


    elect * from Table1 where trnDate>=getdate()-365;


    please check it...
     
    RaviAuto, Oct 24, 2011 IP