Error in Querying Concatenation of 2 fields in LibreOffice Base SQL -
my apologies wrong terminilogies, not programmer, base user confronted problem.
i'm having trouble querying column supposed concatenation of 2 fields of 2 separate tables. i'm using libreoffice base version 1:3.6.2 , has default hsql engine.
my 2 tables follows:
table 1 named "prefectures"
, has following fields: id, "prefecture name"
, , "state"
table 2 named "ward"
, has following fields: id, "ward name"
, , prefecture id foreign key referencing table 1.
what want query produce these 2 colums: "ward name, prefecture name" concatenation of ward.wardname , prefecture.prefecturename, , ward id
for example. if had prefecture named "cebu" , ward named "lahug" has ward id of 0, want query come "lahug, cebu" on column 1, , "0" in column 2
the base tutorial used seems have modified language compared actual hsql language, @ least based on programmer friends reaction. know attributes referred table.attribute
, example, in base, use "attribute"
, or, if not mistaken, when 1 needs specify table of origin, "table"("attribute")
. however, know modified language works because used create 2 tables.
anyways, hazarding on learned base tutorial document, came with:
select "ward name" || ', ' || "prefecture name" "wrd_pref", "ward id" "prefecture" inner join "ward" on "prefecture" ("prefecture id") = "ward" ("prefecture id") ;
and error message came was: "the data content not loaded. access denied: prefecture in statement [the whole code above]"
i have suspicion misread due wrong syntax on part. perhaps guess on using perentheses in case wrong? if so, why error message "access denied"? checked both records , sql codes of 2 tables, both normal.
edit: no, don't want split 2 fields. need them concatenated going use them list items in dropdown list form making.
the sql query one. tables called "prefectures" , "ward", used in clause.
select "ward name" || ', ' || "prefecture name" "wrd_pref", "ward id" "prefectures" inner join "ward" on "prefectures"."prefecture id" = "ward"."prefecture id";
Comments
Post a Comment