Skip to content

Tag: sql

How can a query select dates from only a specific academic year?

This may be simple, but I cannot figure out the correct and simplest way to query a table which contains a date col to return the rows in which the date belongs to the current academic year. Knowing that for academic year I mean the period from the 1st of September of a year to the 31st of august of

MySQL Query join last comment to topic

I have a topic and topic_comments table. I want to join them both. The join is on topic.id = topic_comments.parent_id. I want to show the topic with latest comment and order by latest comment createdate. And not show duplicate topics. Can anyone help me? So far I have this: This however doesn ‘t show to…

REPLACE empty string

I discover some behavior I didn’t know before. Why this line of code does not work? I can’t even have ” in where condition. It just doesn’t work. I have this from imported Excel where in some cells are no values but I’m not able to remove them unless I used LEN(”) = 0 funct…