SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old June 27th, 2003, 03:10 AM
Hena Hena is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 28 Hena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Double data trouble.

Here's a nice query I'm using to fetch data to access prices for items.

The trouble is that it fetches the correct data, twice!

The problem is probably caused by the following;
-DLG_ITEM.ITEMID is unique
-KATSELU_REPRO_NEEDS_BUFFER is not unique, it can have many ITEMID's

The nice query:

SELECT KATSELU_REPRO_NEEDS_BUFFER.PROJID, KATSELU_REPRO_NEEDS_BUFFER.COMPANY, KATSELU_REPRO_NEEDS_BUFFER.WORK_NUMBER, KATSELU_REPRO_NEEDS_BUFFER.UNIT, KATSELU_REPRO_NEEDS_BUFFER.ITEMID, KATSELU_REPRO_NEEDS_BUFFER.ITEMNAME, (KATSELU_REPRO_NEEDS_BUFFER.ITEM_TYPE) AS Expr1, KATSELU_REPRO_NEEDS_BUFFER.NEED_TYPE, KATSELU_REPRO_NEEDS_BUFFER.NEED_STATUS, (KATSELU_REPRO_NEEDS_BUFFER.QTY) AS QTY, (KATSELU_DLG_ITEM.AVGPRICE) AS AVGPRICE
FROM KATSELU_REPRO_NEEDS_BUFFER, KATSELU_DLG_ITEM
WHERE (((KATSELU_REPRO_NEEDS_BUFFER.ITEMID)=[KATSELU_DLG_ITEM].[ITEMID]) AND ((KATSELU_REPRO_NEEDS_BUFFER.NEED_TYPE_NAME)='NIP -mat.varaus'));


Here's how it works;
-for every PROJECT, WORK_NUMBER, ITEMID
-fetch QTY (quantity) from REPRO table
-fetch AVGPRICE from DLG_ITEM table

the result should be an amount of rows equal to the amount of rows in REPRO table, but somehow, the amount isn't that, it's double.. because the original REPRO table holds 6804 rows, while my result is 13582.

Has anyone got any wise solutions?

Hena

Reply With Quote
  #2  
Old June 27th, 2003, 05:10 AM
Hena Hena is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 28 Hena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Oh, now I feel silly, have been tearing hairs for the last hours, but couldn't figure it out..

Then I just checked with a modified query why it would show double amounts, in the end, DLG_ITEM didn't have ITEMID as unique as I first mentioned, it's unique only per COMPANY, but I ofcourse had forgotten the universal company='our company' :P

Problem solved anyhow

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Double data trouble.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway