In 1_products t2 I have other columns called make,model
When I add them
(SELECT
t2.code,t2.make,t2.model
FROM .....
I get
Error 1241 Operand should contain 1 column(s)
SELECT
t1.fk_products_id,
(SELECT
t2.code
FROM
1_products t2
WHERE
t2.id = t1.fk_products_id
order by code
limit 1)
FROM
1_stock t1
WHERE
t1.branch = 1 and t1.dispatch <> 0;
You cannot return more than one column in an inline query. If you want to return more than one column for each
t1.fk_products_idthen you will have to rewrite the query similar to this: