Select
sales_order_lines.sales_order_linesid,
CONCAT('S',LPAD(sales_order_lines.sales_orderid,8,'0')),
sales_order_lines.item_code,
sales_order_lines.name,
sales_order_lines.qty,
sales_order_lines.supplier_ordered_qty,
stock_items.cost_price_excluding_vat,
sales_order_lines.selling_price_excluding_vat,
sales_order_lines.ordered,
supplier.company_name
From
sales_order_lines
Inner Join stock_items ON stock_items.stock_itemsid = sales_order_lines.stock_itemsid
Inner Join sales_order ON sales_order.sales_orderid = sales_order_lines.sales_orderid
Inner Join supplier ON supplier.supplierid = stock_items.supplierid
order by sales_order_lines.item_code