Code: Select all
tb1: id, codigo1, codigo2, nombre
tb2: id, precio, item
Code: Select all
tb2:
id 1
precio $10
item 8
id 2
precio $20
item 1
tb1:
id 1
codigo1 2 (o sea precio $20 e item 1)
codigo2 1 (o sea precio $10 e item 8)
mi pregunta: como se haria la consulta? para que traiga todos los datos?
Code: Select all
#define consulta;
"SELECT "+;
"tb1.id as c1, " +;
"tb1.codigo1 as c2, " +;
"tb1.codigo2 as c3, " +;
"tb2.id as c4, "+;
"tb2.precio as c5, "+;
"tb2.item as c6" +;
"SELECT tb1 " +;
"LEFT JOIN tb2 on tb1.codigo1 = tb2.id " .....
gracias.