Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE tokens ( user_id int, regions int[] ); insert into tokens values (5, array[1,2,3]); CREATE TABLE regions ( id int, ru_name varchar(64) ); insert into regions values (1, 'Region 1'), (2, 'Region 2'),(3, 'Region 3'); with reg_ids as ( select unnest(regions) reg_id from tokens where user_id = 5 ) select regions.* from reg_ids join regions on regions.id = reg_id;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear