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

SQL for comapre(exact match) returns more rows than the required rows

P: n/a
Dear Sir/madam

Here i am having some one sql which returns more rows than the required
rows after comaparing tables
simple sql statement will be lokk like

SELECT t.empcd, s.daicd, s.chucd, s.shocd, t.juncd, s.shoname
FROM temptbl AS t,shomast AS s
WHERE t.shoname=s.shoname;

i am having 115 rows in the TABLE:temptbl after and 10000 rows in the
TABLE:shomast
after execuiting the sql statement it returns around 5 rows extras
(some time 1 row)
returning rows varry when the TABLE: temptbl contents varies
TABLE:shomast is having unique on the daicd, chucd, shocd
TABLE:temptbl will not have key (if i put key also result will be the
same)

TABLE :shomast schema

dai integer
chu integer
sho integer (all the above 3 are composite unique key)
shoname text

TABLE:temp schema
empcode text
juncd integer
shoname text
Please tell me
Under what condiations the results are wrong or returns extra

one more thing is,
if i have 5 diffrent empcode's i will get 5 extra rows,
if i have 10 then 10 extra rows.

Thanks in advance
baka

Jul 23 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Perhaps you could be more specific as to exactly what you are attempting to
achieve, then we could better tell you how to structure your query. You've
expressed in impressive detail what you are getting, but not what you are
trying to get.

"baka" <me*******@hotmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Dear Sir/madam

Here i am having some one sql which returns more rows than the required
rows after comaparing tables
simple sql statement will be lokk like

SELECT t.empcd, s.daicd, s.chucd, s.shocd, t.juncd, s.shoname
FROM temptbl AS t,shomast AS s
WHERE t.shoname=s.shoname;

i am having 115 rows in the TABLE:temptbl after and 10000 rows in the
TABLE:shomast
after execuiting the sql statement it returns around 5 rows extras
(some time 1 row)
returning rows varry when the TABLE: temptbl contents varies
TABLE:shomast is having unique on the daicd, chucd, shocd
TABLE:temptbl will not have key (if i put key also result will be the
same)

TABLE :shomast schema

dai integer
chu integer
sho integer (all the above 3 are composite unique key)
shoname text

TABLE:temp schema
empcode text
juncd integer
shoname text
Please tell me
Under what condiations the results are wrong or returns extra

one more thing is,
if i have 5 diffrent empcode's i will get 5 extra rows,
if i have 10 then 10 extra rows.

Thanks in advance
baka

Jul 23 '06 #2

P: n/a
one more thing is,
if i have 5 diffrent empcode's i will get 5 extra rows,
if i have 10 then 10 extra rows.

Answered your own question... Check it out. Try removing the extra
table.

Jul 23 '06 #3

P: n/a
Thanks for the reply,
What i am going to achive?
Yes i am geeting the code (dai,chu,sho) for all shoname in TABLE:temp.
Not more not less.

Thanks in advance
baka
ByteMyzer のメッセージ:
Perhaps you could be more specific as to exactly what you are attempting to
achieve, then we could better tell you how to structure your query. You've
expressed in impressive detail what you are getting, but not what you are
trying to get.
Jul 30 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.