-1
Query that this marked red does not work and blue works!
SELECT * FROM posts LEFT JOIN (SELECT COUNT(id_rela_post), ifnull(qt_vezes, 0), para FROM rela_post GROUP BY para) post_detalhe on posts.id_post = post_detalhe.para
-1
Query that this marked red does not work and blue works!
SELECT * FROM posts LEFT JOIN (SELECT COUNT(id_rela_post), ifnull(qt_vezes, 0), para FROM rela_post GROUP BY para) post_detalhe on posts.id_post = post_detalhe.para
2
The correct thing would be to put the IFNULL(COUNT(id_rela_post), 0)
, instead of putting it in the search alias.
did it gave error! still obg by help!
Browser other questions tagged sql mysqli
You are not signed in. Login or sign up in order to post.
Any error appears on the screen?
– Valdeir Psr
#1064 - You have a syntax error in your SQL next to '(qt_times, 0), for FROM rela_post GROUP BY to) post_detail on posts.id_post ' on line 1
– AKU
Missing a comma after the
COUNT(id_rela_post)
– arllondias
n missing comma, I just put and gave Error
– AKU
Place code as text, not as image.
– Victor Stafusa
After putting the comma, did you make the same mistake or was it a new mistake? You can place the querys instead of photos/images. We’re a community of programmers, so it’s easier to copy and test than to go to the trouble of having to look at images and type everything back in. If you can help those who help you everything will flow better.
– Guilherme Nascimento
I’ve pasted the post, but I don’t understand what difference it makes to have the query if you don’t have the database!
– AKU
The field
qt_vezes
needs to be in the group by.... oifnull
is not an aggregation function.– Andrey
qt_times it and COUNT AS(id_rela_post) I want it to return 0 instead of null
– AKU
@AKU is required to have in text, as the chance to rewrite its code with a new error (in this case ours) is great. By putting your code in text we can copy it how he is. Consider including all your attempts and error codes for each of them within the question to try to reverse the negative votes and make it easier to fix the problem.
– bio