December 31, 2011

How to make Table Joins in PHPmyAdmin

Question by Mark

I have 2 Tables in phpmyadmin that need joining

tracklisting is my one and catelogue is the other, and are saved as innodb

They both have a column CAT.NO and would like it to be joined on this column. In catelogue it is the primary and in tracklisting it’s indexed

catelogue is my parent and tracklisting would be the child as it doesn’t have info for every record in catelogue. I believe this would be correct unless I’m wrong

How do I do this so that when I query on a column in tracklisting it only brings up the matches for ‘catelogue’ because I want to know what album it’s on and not my entire 60000+ catelogue

Can this be done with phpmyadmin’s interface or is this a sql statement

Many thanks

EDIT:

This was the code that worked

SELECT *
FROM tracklisting
INNER JOIN catelogue ON catelogue.`CAT NO.` = tracklisting.`TRACKLISTING CAT NO.`
WHERE tracklisting.`ARTIST` LIKE 'placebo'

Thanks to everyone that helped out

Answer by Starx

I dont know if this can be done with the interface, but with sql

SELECT * 
FROM 
  tracklisting t 
  INNER JOIN catelouge c on c.catno=t.catno 
WHERE t.id = 1

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!