query query :-)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NDS Ltd

    #1

    query query :-)

    hi,

    someone on this group made me a query which worked a treat. i have tried
    changing it but instead of returning the expected 700 records it returns
    half a million.. with lots of duplicates. (there isnt even that many
    records in the table). Excuse the phrase 'smellfone' it is a private Joke!

    here is the query that works

    select * from smellfonesales left join commissions using (imei) where
    commissions.ime i is null AND smellfonesales. TimeStamp like '%2004%'

    and here is the one i am trying but it dont work. hopefully you will be
    able to work out what I am trying to achieve (which is to get supplier info
    from a seperate table linked by field imei)

    select smellfonesales. *,smellfonecont racthandsets.su pplier from
    smellfonesales, smellfonecontra cthandsets left join commissions using (imei)
    where commissions.ime i is null AND smellfonesales. TimeStamp like '%2004%'

    this query gices results.. but way too many and lots of duplicates for some
    reason...


    any help is appreciated.

    --
    Sean Browne
    NDS Ltd
    07971 175 354



  • Aggro

    #2
    Re: query query :-)

    NDS Ltd wrote:
    [color=blue]
    > select smellfonesales. *,smellfonecont racthandsets.su pplier from
    > smellfonesales, smellfonecontra cthandsets left join commissions using (imei)
    > where commissions.ime i is null AND smellfonesales. TimeStamp like '%2004%'
    >
    > this query gices results.. but way too many and lots of duplicates for some
    > reason...[/color]

    You don't compare any of the fields in smellfonecontra cthandsets table,
    to fields of another table in your query. That means that every row in
    smellfonecontra cthandsets table is connected to every row in your
    smellfonesales table. (Or atleast similar results are returned.)

    Without knowing what you want, I can't help you with the query. I have
    no idea to what table it should be connected to, and what fields in each
    table should be used for connecting.

    Comment

    Working...