Tuesday 15 March 2011

php - Combine queries to grab foreign key value from different able based on result in mssql -



php - Combine queries to grab foreign key value from different able based on result in mssql -

i have work mssql database have no command over, sadly, can't alter construction @ all. database setup there 2 tables entry , area. in area table, there column sarea need based on value ixentry. in entry table, can (the variables php variables):

select stitle,ixcategory,ixarea entry ixentry='$ixentry'

and sec query

select sarea area ixarea='{$return['ixarea']}'

which works fine, except way network setup, there considerably more overhead time 2 queries.

how can combine these 2 queries have result equivalent of select stitle,ixcategory,sarea entry ixentry='$ixentry' if sarea in entry table, not ixarea?

select a.sarea entry e inner bring together area on e.ixarea = a.ixarea e.ixentry='$ixentry'

php sql-server

No comments:

Post a Comment