I have 3 tables.
Table 1 : t_atc_list
id | a_name | s_title | r_name
------------------------------
80 | ss | 128 | 5
Where s_title & r_name is foreign key.
Table 2 : t_s_list
s_id | title
-------------
128 | Song Title
Table 3 : t_r_list
r_id | r_name
--------------
5 | Artist
I have used following query to have desired output in this format Song Title- Artist using album name that is a_name
$resultid=mysql_query("SELECT s_title, r_name FROM t_atc_list where a_name='$album' ");
$rowid=mysql_fetch_array($resultid);
$query=mysql_query("SELECT s.title, r.r_name FROM t_a_list as a, t_r_list as r, WHERE s.s_id=$rowid('s_title') and r.r_id= $rowid('r_name')");
$row=mysql_fetch_array($query);
I think the SQL query you want is:
FWIW, your table naming conventions and your schema in general are pretty wacky. At the very least, what’s wrong with “tracks”, “songs” and “artists”, or whatever they are supposed to be (or for purists, “track”, “song”, “artist”) for your table names?