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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining 2 Tables with a third as indicator - please help me

Status
Not open for further replies.

humer

Programmer
Aug 21, 2003
1
DE
I have 3 tables
-articles (aprox. 25.000 rows)
-corr (aprox. 400.000 rows)
-types (aprox. 4.000 rows)

I have to combine articles.id with types.idlink
corr holds the correlation between them artid and typeid

so if the type is given, I want to check out the matchid article-ids and select them out of article.

This should run with one single query under mysql 3.23.55
 
can u give me the correlation between:
article and corr
corr and type tables?

Known is handfull, Unknown is worldfull
 
It's a fairly simply join:

SELECT
*
from
type t, corr c, articles a
where
t.idlink = c.typeid and
c.artid = a.id and
t.<type column> = <your type value>

The first conjoin relates type to corr. The second relates coor to articles. The third constrains the return to only those records where the type is a specific value.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top