Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Call function in FROM clause (SQLite - json_each or MySQL - json_table) #60

Open
@JYone3A

Description

@JYone3A

It seems unsupported to call functions from within the FROM clause. Working example for SQLite:

SELECTone.name, group_concat(j.value,',')FROM one, json_each(one.stringArray)AS jGROUP BYone.id

Tableone:

CREATETABLEone (    idINTEGERPRIMARY KEY AUTOINCREMENT,    nameTEXT,    stringArrayTEXTCHECK(json_valid(stringArray)))

Data:

INSERT INTO"one" ("id","name","stringArray")VALUES ('1','John Doe','["apple","banana","cherry"]');INSERT INTO"one" ("id","name","stringArray")VALUES ('2','Alice Smith','["banana","grape","cherry"]');INSERT INTO"one" ("id","name","stringArray")VALUES ('3','Bob Johnson','["banana","apple","grape"]');

Update 1: also does not work with thejson_table function supported by MySQL (seehttps://dev.mysql.com/blog-archive/json_table-the-best-of-both-worlds/):

SELECT people.*FROM t1,      JSON_TABLE(json_col,'$.people[*]' COLUMNS (                nameVARCHAR(40)PATH'$.name',                addressVARCHAR(100)PATH'$.address')     ) people;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp