First and Last data

  • from the below table I need the Last_data and last_data from 6 month. with different DB_name

    so my output would look like :

    DB_name backup_start Backup_finish

    Stock_any 8/1/2016 8/1/2016

    Stock_any 1/1/2017 1/1/2017

    Bond 8/1/2016 8/1/2016

    Bond 1/1/2017 1/1/2017

    DB namebackup StartBackup Finish

    Stock_Any5/1/20165/1/2016

    Stock_Any6/1/20166/1/2016

    Stock_Any7/1/20167/1/2016

    Stock_Any8/1/20168/1/2016

    Stock_Any9/1/20169/1/2016

    Stock_Any10/1/201610/1/2016

    Stock_Any11/1/201611/1/2016

    Stock_Any12/1/201612/1/2016

    Stock_Any1/1/20171/1/2017

    bond5/1/20165/1/2016

    bond6/1/20166/1/2016

    bond7/1/20167/1/2016

    bond8/1/20168/1/2016

    bond9/1/20169/1/2016

    bond10/1/201610/1/2016

    bond11/1/201611/1/2016

    bond12/1/201612/1/2016

    bond1/1/20171/1/2017

  • Nita Reddy (1/11/2017)


    from the below table I need the Last_data and last_data from 6 month. with different DB_name

    so my output would look like :

    DB_name backup_start Backup_finish

    Stock_any 8/1/2016 8/1/2016

    Stock_any 1/1/2017 1/1/2017

    Bond 8/1/2016 8/1/2016

    Bond 1/1/2017 1/1/2017

    DB namebackup StartBackup Finish

    Stock_Any5/1/20165/1/2016

    Stock_Any6/1/20166/1/2016

    Stock_Any7/1/20167/1/2016

    Stock_Any8/1/20168/1/2016

    Stock_Any9/1/20169/1/2016

    Stock_Any10/1/201610/1/2016

    Stock_Any11/1/201611/1/2016

    Stock_Any12/1/201612/1/2016

    Stock_Any1/1/20171/1/2017

    bond5/1/20165/1/2016

    bond6/1/20166/1/2016

    bond7/1/20167/1/2016

    bond8/1/20168/1/2016

    bond9/1/20169/1/2016

    bond10/1/201610/1/2016

    bond11/1/201611/1/2016

    bond12/1/201612/1/2016

    bond1/1/20171/1/2017

    Please present your data in consumable format – you've been here long enough to know how to do this.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • What have you tried?

    How do you define Last_data and last_data from 6 month?

    Are the backup Start and Backup Finish dates always the same? Do they include times?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Nita Reddy - Wednesday, January 11, 2017 11:32 AM

    from the below table I need the Last_data and last_data from 6 month. with different DB_nameso my output would look like :DB_name backup_start Backup_finishStock_any 8/1/2016 8/1/2016Stock_any 1/1/2017 1/1/2017Bond 8/1/2016 8/1/2016Bond 1/1/2017 1/1/2017DB namebackup StartBackup FinishStock_Any5/1/20165/1/2016Stock_Any6/1/20166/1/2016Stock_Any7/1/20167/1/2016Stock_Any8/1/20168/1/2016Stock_Any9/1/20169/1/2016Stock_Any10/1/201610/1/2016Stock_Any11/1/201611/1/2016Stock_Any12/1/201612/1/2016Stock_Any1/1/20171/1/2017bond5/1/20165/1/2016bond6/1/20166/1/2016bond7/1/20167/1/2016bond8/1/20168/1/2016bond9/1/20169/1/2016bond10/1/201610/1/2016bond11/1/201611/1/2016bond12/1/201612/1/2016bond1/1/20171/1/2017

    You mention "from 6 month", but your sample output includes August 1st and January 1st, which are exactly 5 months apart, not six.   Please explain that discrepancy as well as provide your data in consumable form, which means CREATE TABLE statements and INSERT statements.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply