-----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".
Regards
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBAgAGBQJX/PdKAAoJELDKYwaoS9AIfc8P/2cfQLerrnBWR9ssQIGPu/ER
aFXiin7JTyos6M8kJS8+yIKKQsldQFXNdUKvoe3qTsuu49abz8rDzrF0Pr8nvMQ0
e2YQBiwPZa9P6mUHAqvNkvhdeiw8NlHwZbbOHymq6tArIJM/IUU83PGgRRvlmODg
3MGH5Y8PzQEjYEeN5Vrw0UTBo0kbrLdLHV4hxifk8ipALuOajhPU1MtLOVy1pyZK
SNO+oQE4eRe9RLrhuom5AHAa2NH5QNRFkH7cqJch9BUGa4JJcEWcryt9F2G7NChY
9ji4ofw67kRmpEMBpyaJst8T0FJ5SYUwAsS9DvGrPOCnU95U0omPd0yveOCqW6c+
JXSOIKT90A9JTAejOycLs3dfluvD+6VKX3OaDILZaUcxeibAKiprKGwdp93M9WqX
myEr/0Mq42DJUkcDfiqacY2x5obUdCYvKtylQxZymYanXTzn77KROXULdcWZKdAc
k5qt/fHEUWFwjRtKKtaQnI005gdGOfJhvwLR/LraRQ2y0s48Iea0K1B40ysUFNou
FAiyyNLN4yFeaJtkbc4EO9kBSlywqQ7J2xTFp8ehcmbqfeVq0k7sd9LOTsDPDQTj
fCXnM3UOP0vKwjmX/kXJv16SGCdffhu5wSRUnPdViqeJVJ3TWhdmVXgSKjYufmJG
bbxdq3dREievvMgk/XXd
=h7BU
-----END PGP SIGNATURE-----
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
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.