473,394 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
3 2256
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari Pulapaka | last post by:
Hi, I have a list of space delimited strings ending in a newline. Eg: a = Now inside each row, I have a space delimited list of fields. Now I want to compare the fields in each row of the...
31
by: Roland Hall | last post by:
I've read numerous articles, more than I can count, on ASP performance. I see conflicting information so I did some tests on my own. getstring and getrows are actually faster than recordset...
2
by: RitaG | last post by:
Hi. In a VB.Net program I use File.Copy to copy some zipped (and text) files from one server to another. I'm required by management to do a file compare after the copy has completed. Is the...
1
by: John Martin | last post by:
This should be an easy match, but I'm lost. I want to perform a kind of grouping of the data in a datagrid object, so that only the first occurrence of a value in column one is visible. The...
21
by: Willie jan | last post by:
place this behind a button that fills a listbox. as you will see the time is now and then 0 or filled in???????????? by hitting the button. is there a way to determine the real elapsed time? ...
4
by: anderskj1 | last post by:
Hey I need a string comparison algorithm which can comapre 2 strings and come with a number, eg %, which indicates how much the string a alike. I could of course just comapre the number of...
4
by: Atul Kumar | last post by:
comapre column value of two row of same table. suppose in table tabl1 have column name comn1 it has two row means two value... after comparison i have to return some value like true or...
3
by: sonymathur | last post by:
I'm using two datasets DS1 & DS2 (both hold data with same schema) in VB.Net 1.1 DS1 is main datasets and DS2 is like subset to DS1.Now how should i remove datarows from DS1 that are like in DS2....
7
by: King | last post by:
I am facing a problem where I am really confused about it. I am trying to compare to instances using: if inst1 == inst2 These instances have a overridden method __str__ which returns same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.