-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Gary,
SELECT "event_name", "first_name", "middle_initial", "last_name",
"sex", "age", "email", "place", CASE WHEN "age" BETWEEN 0 AND 18
THEN 'Youth' WHEN "age" BETWEEN 19 AND 59 THEN 'Adult' ELSE
'Senior' END "Group", CASE WHEN "place" <= 3 THEN ( SELECT
"finish", "ribbon" FROM "Ribbons" WHERE "ID" = "place" ) WHEN
"place" >= 4 THEN ( SELECT "finish", "ribbon" FROM "Ribbons" WHERE
"ID" = "4" ) END "Finish", "Ribbon" FROM "Results"
1. A subselect must have only one row with one field.
2. If you want to connect a subselsect with the outer select, you have
to write a correlative select.
SELECT "event_name", "first_name", "middle_initial", "last_name",
"sex", "age", "email", "place",
CASE
WHEN "age" BETWEEN 0 AND 18 THEN 'Youth'
WHEN "age" BETWEEN 19 AND 59 THEN 'Adult'
ELSE 'Senior'
END "Group",
CASE
WHEN "place" <= 3 THEN ( SELECT "finish" FROM "Ribbons"
WHERE "ID" = "a"."place" )
WHEN "place" >= 4 THEN ( SELECT "finish" FROM "Ribbons"
WHERE "ID" = "4" )
END "Finish",
CASE
WHEN "place" <= 3 THEN ( SELECT "ribbon" FROM "Ribbons"
WHERE "ID" = "a"."place" )
WHEN "place" >= 4 THEN ( SELECT "ribbon" FROM "Ribbons"
WHERE "ID" = "4" )
END "Ribbon"
FROM "Results" AS "a"
With "a"."place" the subselscts reads the value of "place" from the
current row, which is read out from "Results".
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.