-
Notifications
You must be signed in to change notification settings - Fork 54
Multiple Queries in a request
Igor Dianov edited this page May 29, 2024
·
1 revision
If multiple queries are part of the same request, they are executed sequentially, the individual responses are collated and returned together. You can fetch objects of different unrelated types in the same query.
For example, fetch a list of authors and a list of books in the same query:
query {
Authors(where: {name: {EQ: "Leo Tolstoy"}}) {
select {
id
name
}
}
Books(where: {author: {name: {EQ: "Leo Tolstoy"}}}) {
select {
id
title
}
}
}
{
"data": {
"Authors": {
"select": [
{
"id": 1,
"name": "Leo Tolstoy"
}
]
},
"Books": {
"select": [
{
"id": 2,
"title": "War and Peace"
},
{
"id": 3,
"title": "Anna Karenina"
}
]
}
}
}