I can’t figure out why I can’t select multiple columns in the second table. Here are my tables:
Computers:
----------
id, cond, type
Images:
-------
id, foreignid, name, width, height, def
Here is my select statement:
SELECT
id, cond, type,
(SELECT name, width, height FROM images WHERE foreignid = computers.id ORDER BY def DESC LIMIT 1) AS image
FROM computers
This is the error I am getting:
Operand should contain 1 column(s)
Are you trying to do something like this?
EDIT:
But the join clause depends on what exactely you want.
If you want all computers, have they images or not use
If you want all images, have they computers or not use
If you want only computers with images and images with computers use
If you want all computers and all images use