Page 1 of 5 123 ... LastLast
Results 1 to 15 of 63
  1. #1
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270

    Unanswered: Union Query Difference

    Guys can you tell me whether there is any difference between the following queries.......... Both of them are resulting same number of records. Not sure whether the output is same or not. Just wanted to know if result output wise if there is no difference than performance wise there might be some. Kinldy educate me on the same.



    SELECT * FROM FRProposalOutline FPO
    INNER JOIN SC_Collection SCC
    ON
    FPO.Items = SCC.CollectionGID
    UNION
    SELECT * FROM FRProposalOutline FPO
    INNER JOIN SC_Collection SCC
    ON
    FPO.PageBreakPositions = SCC.CollectionGID


    SELECT * FROM FRProposalOutline FPO
    INNER JOIN SC_Collection SCC
    ON
    FPO.Items = SCC.CollectionGID OR
    FPO.PageBreakPositions = SCC.CollectionGID

    Thanks,
    Rahul Jha

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Yes.

    -PatP

  3. #3
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    not jus yes patty........ something mooooooooooooooore.......

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What have you found out on your own so far?
    George
    Home | Blog

  5. #5
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    Here is it Georgy..............

    Quote Originally Posted by DBA_Rahul



    Both of them are resulting same number of records. Not sure whether the output is same or not







  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Would it be worth finding out if the output is the same then?
    If you want to compare two queries, surely the resultset is one of the things you want to check!
    George
    Home | Blog

  7. #7
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    Quote Originally Posted by DBA_Rahul
    Not sure about the result

    I want to know if the results are same then will there be any performace issues?



    Thanks,
    Rahul Jha

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Why can't you work out if the results are the same? I'm sure as hell not doing it for you.
    George
    Home | Blog

  9. #9
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    total number of records in the result set is 2214567



    Thanks,
    Rahul Jha

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I have two t-shirts, both are black with designs on them, therefore they are the same.
    T-shirt 1
    T-shirt 2

    Are they the same?

    Just because you get the same numbers, doesn't mean the resultsets are the same. PROVE they are correct, then come back.
    George
    Home | Blog

  11. #11
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    Quote Originally Posted by georgev
    Just because you get the same numbers, doesn't mean the resultsets are the same. PROVE they are correct, then come back.
    This is what I have mentioned in the begining only........

    Quote Originally Posted by DBA_RAHUL
    Both of them are resulting same number of records. Not sure whether the output is same or not.

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This is like banging your head against a brick wall - I'm out of this thread
    George
    Home | Blog

  13. #13
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    y is some one getting into the number of records issues.......... issue is to c the query and answer whether they are same or not (result wise as well as performance wise). Dats it......


    Thanks,
    Rahul Jha

  14. #14
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Run them both in QA and check the execution plans.
    If it's not practically useful, then it's practically useless.

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

  15. #15
    Join Date
    Nov 2005
    Location
    San Francisco, CA
    Posts
    506
    Quote Originally Posted by DBA_Rahul
    y is some one getting into the number of records issues.......... issue is to c the query and answer whether they are same or not (result wise as well as performance wise). Dats it......
    Thanks,
    Rahul Jha
    Rahul Bhai ,I think you if you set theory you can easily find the answer.And another thing before asking again plz go through the basics of UNION and INNER JOINs.Trust me ,you will find all your doubts cleared.
    Success is the ability to go from one failure to another with no loss of enthusiasm.
    - Sir Winston Churchill
    Joydeep

Posting Permissions

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