Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this query?

Status
Not open for further replies.

Bokazoit

Technical User
Sep 16, 2004
73
DK
I have 3 tables

One with maindata, and has the following coloumns:

StoreID, SKUID, Revenue and period

Then I have create two tables with detailed information for each store and for each SKU

The Storetable has these coloumns:

StoreID, Storename, Chain-sub, Chain

StoreID in my Storetable match StoreID in my maindata-table. So they should combine with each other so that I can draw storename, chain-sub and Chain into my query.

The SKU-table has these coloumns:

SKUID, SKU-name, Own-category

SKUID in the SKU-table match SKUID in the maintable. That way I seek to sort each SKU according to our internal Categories.

I'm only testing and currently my maindata-table has 71884 rows, and now things get strange. When I create a query and create relations between my maindata-table and the two other tables I get 73906 rows. That doesn't look right to me and what is wrong?

Here is the query I create:

SELECT Butiksliste.Kæde, Butiksliste.[Kæde-sub], Butiksliste.Butiksnavn, [CP Kategorisering].[CP Kategori], Data.[Oms (kr)]
FROM (Butiksliste INNER JOIN Data ON Butiksliste.Butiksnr = Data.Butik) INNER JOIN [CP Kategorisering] ON Data.Vare = [CP Kategorisering].Vare;

Below I have translated it into the explaination above:

SELECT Storetable.chain, Storetable.[Chain-sub], Storetable.Storename, [SKU-table].[Own Category], Maindata.[Revenue]
FROM (Storetable INNER JOIN Maindata ON Storetable.StoreID = Maindata.StoreID) INNER JOIN [SKU-table] ON Maindata.SKUID = [SKU-table].SKUID;


Hope You can help

In advance tx :)
 
Damn I'm stupid...tx that was it ^^

I thought I was careful but not enough [sadeyes]

Tx very much :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top