For example
I have two tables.
tabel1: category has two fields
categorycode, categoryname
table2: products has fields
categorycode, productcode, productname, productprice etc.
i want to display all the products with all its fields values (but replacethe categorycode with categoryname)
approach 1
select product.*, category.name from product, category where categorycode.categorycode=product.categorycode
appoaceh 2
select * from product
also
select * from category
and get the array to transfer categorycode to categoryname categoryname[categorycode]="categoryname"
then display the results from "select * from product"
but use the categoryname[categorycode] instead of categorycode in the display.
which one is better?
the approach 1 is the standard approach i think. but the approach 2 i may be able to reuse in some cases.