By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,956 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,956 IT Pros & Developers. It's quick & easy.

query query :-)

P: n/a
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.imei 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.*,smellfonecontracthandsets.supplie r from
smellfonesales,smellfonecontracthandsets left join commissions using (imei)
where commissions.imei 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

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
NDS Ltd wrote:
select smellfonesales.*,smellfonecontracthandsets.supplie r from
smellfonesales,smellfonecontracthandsets left join commissions using (imei)
where commissions.imei is null AND smellfonesales.TimeStamp like '%2004%'

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


You don't compare any of the fields in smellfonecontracthandsets table,
to fields of another table in your query. That means that every row in
smellfonecontracthandsets 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.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.