Answer the question
In order to leave comments, you need to log in
What does this sql query say?
Tell me what the following code says:
$sql = "SELECT
*
FROM
history h
WHERE
h.message = 'Blah-Blah'
AND
h.context->>'current_user' = '$id'
";
$queryBuilder->select('*')
->from('history', 't')
->where('h.message = :message');
->andWhere('h.context->>curent_user = :id')
->setParameter('message', 'Blah-Blah')
->setParameter('id', $id)
->execute();
Answer the question
In order to leave comments, you need to log in
h is an alias to the history table . Needed so that when specifying a column from the table in other parts of the query, do not write the word "history" in its entirety.
No, you lost the quotes and the second "r" in the word "current". It should be like this:
Tell me what the following code says:
Subtract the data of all columns from the "history" table. Search only rows where the value of the "message" field is equal to "Blah-Blah" and the value of the "current_user" parameter of the json object stored in the "context" field is equal to the variable "$id"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question