hey guys can somebody point me to examples how to ...
# orm-help
p
hey guys can somebody point me to examples how to do joins using prisma?
n
Copy code
query {
  users {
    id
    posts {
      id
    }
  } 
}
this joins users to posts
p
joins and selects?
I would like to join to make a condition. Lets say I have photos with tags and I want to get all photos with some specific tag
n
conceptually my query above is equivalent to
SELECT User. id, Post.id FROM User, Post where Post.userId = User.id
I am not sure what you are actually asking 🙂
p
Im asking about
select user.id, user.name FROM user INNER JOIN userTags ON userTag.userId = user.id AND  tag.id = tag.id INNER JOIN tag ON tag.name = 'someTag'
so basically it means give me user tagged by “someTag”, and don’t want to select any other data
n
yea there's a
where
input field for the
users
query
p
yeah Im aware about that where, I just wanted to see some example showing how to build that
where
to do what I want
n
deploy that data model and then explore the API in the Playground 🙂
p
thx
Copy code
users (where: {
    photos: {
      filename: "hello.jpg"
    }
  })
is something I wanted to do
is prisma always setup a kinda many-to-many relationship even if there is a single relation used? (
type User { photo: Photo }
)
also, is it possible to see what sql query prisma generates? (enable logging?)
n
I don't understand your first question 🙂 Maybe it's better to post it here: https://www.graph.cool/forum/c/questions You can use logging from your DB to check the generated queries