473,785 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.sho name;

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 2288
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*******@hotm ail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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.sho name;

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
1406
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 array and see which fields do not match.
31
2241
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 looping. However, I've read in looping that Do While...Loop is the fastest and For...Next the slowest but my tests prove otherwise. I've tested: Do...Loop
2
621
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 File.Copy sufficient and it will error out if there's a problem or do I need to do a file compare to make sure nothing went wrong in the copy? If I do need to do a file comapre I was thinking about shelling out and running a bat file to use the Dos...
1
1382
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 following equal rows should be blanked in column one, se example: Col.one Col.two Col.three A Data1 DataA1 Data2 DataA2 Data3 DataA3 B Data1 DataB1
21
4391
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? thanks, Willie Dim T As Double
4
2000
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 occurences of each letter, but then aab woudl be equal aba. This is not good enough. So the algorithm also has to compare closeness og letters etc. I hope i can find a "finished" or skeleton algorithm since i am convicnced
4
24647
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 false................... So tell me any in-built function is there in MS-sql.................
3
2168
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. Thanks In Advance. Sonymathur.
7
1693
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 string. The condition result is true although they are different instances.
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.