0

I found this sentence in the code:

        $dql
            = <<<DQL
SELECT u FROM AppBundle:User u
JOIN u.Roles r
JOIN u.team t
WHERE u.id NOT IN (
      SELECT user.id
      FROM GameBundle:Goal g
      JOIN g.user user
      WHERE
        g.objective = :objective
    )
  AND 
    r.profile = :sales_profile
  AND 
    r.company = :company
  AND 
    u.onlyStatus NOT IN (:status)
DQL;

I don't know how to works that query inside NOT IN sentence, help me please.

I need to know:

  • What return the query inside of NOT IN, (data types, so on...)
  • How to works a query inside of NOT IN (is posible ?)
jjoselon
  • 2,641
  • 4
  • 23
  • 37

1 Answers1

1
SELECT u FROM AppBundle:User u
JOIN u.Roles r
JOIN u.team t
WHERE u.id NOT IN (
      SELECT user.id
      FROM GameBundle:Goal g
      JOIN g.user user
      WHERE
        g.objective = :objective
    )

this means take all the users that don't currently have 'objective' in the 'Goal' table.

Is this what you needed ?

farbiondriven
  • 2,450
  • 2
  • 15
  • 31