webForumDet fria alternativet

en svår join

2 svar · 173 visningar · startad av tlee

tleeMedlem sedan mars 2001290 inlägg
#1

Hej!

Jag har problem med en join av två tabeller

tbl_Products:
col_ArticleNr
col_Price
col_Name
col_Group

tbl_Test:
col_ArticleNr
col_Price_1
col_Price_2
col_Price_3
col_Price_4
col_Price_5
col_Visible

--------------------------------------------------------

col_ArticleNr har en relation mellan de båda tabellerna.

Vad jag nu vill göra är en SELECT sats som plockar följande tabeller.

tbl_Products.col_ArticleNr
tbl_Products.col_Price
tbl_Products.col_Name
tbl_Products.col_Group
tbl_Test.col_Price_1
tbl_Test.col_Price_2
tbl_Test.col_Price_3
tbl_Test.col_Price_4
tbl_Test.col_Price_5
tbl_Test.col_Visible

DÄR col_ArticleNr är lika i båda tabellerna och tbl_Products.col_Group=CPU ?

Kan någon hjälpa till med detta, jag får ingen fason på det alls :(

Tack!

/Tobias

spangoMedlem sedan juni 20008 205 inlägg
#2

Tja...

SELECT p.col_ArticleNr, p.col_Price, p.col_Name, p.col_Group, t.col_Price_1, t.col_Price_2, t.col_Price_3, t.col_Price_4, t.col_Price_5, t.col_Visible
FROM tbl_Test t, tbl_Products p
WHERE p.col_ArticleNr = t.col_ArticleNr AND p.col_Group = 'CPU'

Lätt som en plätt :)

------------------
"There's no such thing as a stupid question, only stupid people"

tleeMedlem sedan mars 2001290 inlägg
#3

så kunde man göra också ja.. ;)

tackar..!

/t

------------------
the man with the golden bottle..

134 ms totalt · 3 externa anrop · v20260731065814-full.3ab8d573
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)