SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create or replace function following_videos() returns table(id uuid, nid integer, user_id uuid, created_at timestamp, url text, image_url text, description varchar(320), mentions text[], tags text[], user_name varchar(32), user_full_name varchar(32), user_image_url text) as $func$ select videos.id, videos.nid, videos.user_id, videos.created_at, videos.url, videos.image_url, videos.description, videos.mentions, videos.tags, users.name as user_name, users.full_name as user_full_name, users.image_url as user_image_url from videos inner join users on videos.user_id = users.id where videos.user_id in (select followed_user_id from follow where auth.uid() = following_user_id) and videos.id not in (select video_id from likes where user_id = auth.uid()); $func$ language sql security invoker;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear