Skip to content
Advertisement

Tag: mysql

MYSQL – count number of rows in each table

I would like to know how many rows are in each table in my database. I’ve come so far as to having However i would need to do that on each and every table – and there are a lot. What would me the best way to get a print-out with the table name and it’s row count? Answer I

GROUP BY – do not group NULL

I’m trying to figure out a way to return results by using the group by function. GROUP BY is working as expected, but my question is: Is it possible to have a group by ignoring the NULL field. So that it does not group NULLs together because I still need all the rows where the specified field is NULL. So

SQL Query merging with PHP assistance please

I want to sort the messages by poster_time instead of the usual id incrementing as I have restored a database with auto incrementing id’s and very old messages show up on top I had like to be able to sort them by poster_time to fix that problem. I’ve attempted to fix this myself but I don’t want to lose any

Mysql SELECT CASE WHEN something then return field

I have two field nnmu and nnmi , and reverse, At first everything looks good, but somehow it mix up values, it work when nnmi and nnmu both are equal to 0, but when either value is 1 it returns nonsense. Any help? Answer You are mixing the 2 different CASE syntaxes inappropriately. Use this style (Searched) Or this style

SQL statement to get all customers with no orders

I have a typical Persons table and an Orders table defined in such a way that I can do JOIN query as the following to return Orders for all Persons. The question is, how do I write a statement that would return all Persons with NO Orders? I’m using mysql. Thank all in advance. Answer You may want to use

Advertisement