1 Answer
This seems to be an SQL question rather than a GraphQL question. If you need to get the name
and age
, your GraphQL query should look something like this:
query MyQuery {
profile {
name
age
}
}
But the real issue is how you design and implement your GraphQL API so this query works as expected. In that case, you may use a JOIN
statement to retrieve the data within your profile
resolver.
SELECT a.age, b.name
FROM a INNER JOIN b
ON a.id = b.pid
Note that table have columns not fields. And never store age, (most) people become older every year. Instead store date of birth.
4 hours ago
A minimal reproducible example is a great start when asking for SQL assistance.
4 hours ago