Monday, 15 March 2010

php - Mixing data from two tables in a database -



php - Mixing data from two tables in a database -

i have 2 tables, 1 called location_name looks this,

location shortname longname precolor color hidden 1 sto stockholm #00ff00 #ff0000 0 2 gbg gothenburg #00ffff #ff00ff 0 3 mmo malmö #c6c6c6 #008000 0 4 cph copenhagen #ff0080 #ff8000 0 5 arh Århus #80ff80 #8000ff 1 6 ser service #ffff00 #ffff00 1

and other one, called art_tot, looks lite this

artnr fine art art_text gnr gnr_group sortorder hide location 220101 thing description 2201 1 101 0 3 220102 thing description 2201 1 102 0 2 220103 thing description 2201 1 103 0 3

and im making looks this

pos equipment artnr mon 27-10-2014 tue 28-10-2014 wed 29-10-2014 thu 30-10-2014 fri 31-10-2014 sat 01-11-2014 sun 02-11-2014 sto thing 220101 sto thing 220102 sto thing 220103 sto thing 222001

what need is, color pos right color location_name , have right shortname , have title longname.

so somehow have create the pos td right values location_name based on location column art_tot

or there simpler way this?

i read bring together , ended doing :

$sql ="select a.art_text , a.art , a.art , a.artnr , b.color , b.longname, b.shortname art_tot , location_name b gnr_group =1 , a.location = b.location order sortorder" ;

it works charm, @dwhite.me

php mysql

No comments:

Post a Comment