hi
i have two tables which is named as category and subcategory ..
category fieldnames
1.id
2.name
3.status
subcategory fieldnames
1.id
2.sid (category id)
3.name
4.status
when displaying datas from table 2(subcategory)
i wrote a joint query to fetch the category name from the sid present in the subcategory table..
in the result ., when i displayed name it displays the category and not the sbucategory name.,
how to get both the names using single query...
thanks..
regards
vijay
i have two tables which is named as category and subcategory ..
category fieldnames
1.id
2.name
3.status
subcategory fieldnames
1.id
2.sid (category id)
3.name
4.status
when displaying datas from table 2(subcategory)
i wrote a joint query to fetch the category name from the sid present in the subcategory table..
Code:
<?php
$q1=mysql_query("SELECT a.*,b.name FROM category as b,subcategory as a WHERE a.sid=b.id");
$r1=mysql_fetch_array($q1);
echo $r1['name'];
?>
how to get both the names using single query...
thanks..
regards
vijay
Comment