On 2017/03/01 3:40 AM, do...@mail.com wrote:
# SELECT * FROM processors UNION SELECT * FROM storage;
Error: SELECTs to the left and right do not have the same number of
result columns.
All tables that I created in my database have differing column names,
values, and amounts of columns with the noted exception of the one
column which is common (board). I've no idea what to do now.
Why is this an error?
I think that perhaps you are new to SQL and other replies assumed you
simply wanted what you wrote. I could be wrong, but just in case, here
are my suggestions:
Perhaps what you would rather like to do is JOIN these tables and not
UNION them?
Do you wish to match /every/ processor with /every/ board?
In this case, the statement should read: (Warning: this could produced
excessively long listings)
SELECT * FROM processors, storage;
Do you wish to match only processors and storage that fit on the same
boards?
In this case the statement might read something like:
SELECT *
FROM processors
JOIN storage USING board
;
Do you wish to list /all/ processors and add the storage options for the
same board /if/ there are any?
In this case the statement might read something like:
SELECT *
FROM processors
LEFT JOIN storage ON storage.board = processors.board
;
As you can see, lots of different things can be achieved. A quick course
in SQL via perhaps W3Schools will teach all these in a few hours.
Cheers,
Ryan
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users