Results 1 to 4 of 4

Thread: sql debug help

  1. #1
    Join Date
    Jun 2006
    Posts
    66

    Unanswered: sql debug help

    how can it be that
    when I do the query

    select * from rep where batch=133 it returns 730 and


    select* from rep left JOIN Information ON rep.site = Information.Sitecode where batch=133 returns more then 730

    I want it to return the same records as the first query but with the additional information from the information table --

    what am i doing wrong?

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    I would say that the Information table has more than 730 records in it for batch 133.

  3. #3
    Join Date
    Jun 2006
    Posts
    66
    no but the information table is just linked as a lookup for the site information -- batch is in the rep table not destination so how can second query have more then the first --

    it is somehow returning duplicates because if I do select distinct before the second then it works -- but why is this happening?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by esthera
    it is somehow returning duplicates because if I do select distinct before the second then it works -- but why is this happening?
    because you have duplicate data
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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