Skip to content

Commit b520271

Browse files
Add query to extract JSON Film data
1 parent 766e017 commit b520271

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/misc/select_films_as_json.sql

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
select row_to_json(r)
2+
from (
3+
select 'de.springbootbuch.mongo.Film' as _class,
4+
title,
5+
release_year as releaseYear,
6+
(select array_to_json(array_agg(row_to_json(a)))
7+
from (
8+
select first_name as firstName, last_name as lastName
9+
from film_actor fa
10+
join actor ac using (actor_id)
11+
where fa.film_id = f.film_id
12+
) a
13+
) as actors
14+
from film f
15+
) r;

0 commit comments

Comments
 (0)