Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: SQL Query

  1. #1
    Join Date
    Jul 2004
    Posts
    268

    Unanswered: SQL Query

    Hi All,

    This query doesn't return any results:

    select db.active_start_time as 'Database Backup',
    tl.active_start_time as 'Transaction Log Backup'
    from
    (select name,schedule_id, active_start_time
    from sysjobschedules
    where name like 'DBBkup%') as db
    join
    (select name,schedule_id, active_start_time
    from sysjobschedules
    where name like 'TLBkup%') as tl
    on db.schedule_id = tl.schedule_id


    Any idea why?

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I would be more surprised if it did.

    Have you tried executing the derived tables individually and checking out the schedule_IDs for each of them?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jul 2004
    Posts
    268
    Yes, you're right , it shouldn't run because the schedule_ids are different for dbbkup and tlbkup schedules. What can I match it on?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    How about "ON 1 = 1"? That should get you all the data you need, plus more.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Jul 2004
    Posts
    268
    I have tried your suggestion, it returned 440 rows when the table only has 42 rows. So I don't think it worked.

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Future reference, you probably shouldn't run queries people give you in an online forum if you don't understand what it does...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by inka
    I have tried your suggestion, it returned 440 rows when the table only has 42 rows. So I don't think it worked.
    Sure it did. The 42 rows that you want are in there, plus more just as I promised.

    Quote Originally Posted by Teddy
    Future reference, you probably shouldn't run queries people give you in an online forum if you don't understand what it does...
    Thanks Teddy. I won't bother posting my "Truncate table..." code now.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I think probably the best thing would be to forget code and explain in natural English what your business requirement is. What are trying to do? What do you hope to achieve?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by blindman
    Thanks Teddy. I won't bother posting my "Truncate table..." code now.
    *laughs* Always good for a chuckle
    George
    Home | Blog

  10. #10
    Join Date
    Jul 2004
    Posts
    268
    Never mind. I figured it out all by myself. Thanks for nothing.

  11. #11
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    You're welcome
    Fancy posting your solution so that others can benefit from your findings?

    And just because you don't always get the answer instantaneously, doesn't mean you should be an ingrate.
    George
    Home | Blog

  12. #12
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by georgev
    And just because you don't always get the answer instantaneously, doesn't mean you should be an ingrate.
    I think Inka was referring to the p155 taking.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  13. #13
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I didn't se any 55's, just some of the guys making a joke - not aimed at the post originator.
    George
    Home | Blog

  14. #14
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by inka
    Yes, you're right , it shouldn't run because the schedule_ids are different for dbbkup and tlbkup schedules. What can I match it on?
    So how the heck were WE supposed to know what YOUR business requirements are?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  15. #15
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    Quote Originally Posted by inka
    I figured it out all by myself.
    well, that's the best possible thing that could have happened, right?

    perhaps blindman's comments helped you after all, in a roundabout way.


Posting Permissions

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