SELECT t.id, date, a.Agencia, note, p.name province, zip_code, city, c.name, consignee, invoice FROM ticket_view t JOIN address_view c ON t.address_id = c.id JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia JOIN vn2008.province p ON c.province_id = p.province_id WHERE t.id = #ticket

()

Delivery

SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color, Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount FROM ticket_row_view m INNER JOIN vn2008.Articles a ON m.item_id = a.Id_Article AND ticket_id = #ticket LEFT JOIN vn2008.Origen o ON a.id_origen = o.id ORDER BY concept