skip to Main Content

Mysql SUM with UNION ALL and JOIN

I have 2 tables and I like to get sum of values and also to group by the result. I have this query: SELECT SUM(tr_amount) as total, projects.pr_type from transactions INNER JOIN projects ON projects.pr_name = transactions.tr_pr_name WHERE tr_amount <…

VIEW QUESTION

How to insert UTF8 character with MySQL/MariaDB

I want replace in a column a string of characters with UTF8 characters, using REGEXP_REPLACE and/or REPLACE. $search = mysqli_real_escape_string($id_mysql, $_POST['search']); $new = mysqli_real_escape_string($id_mysql, $_POST['new']); mysqli_query ($id_mysql, "UPDATE table_name SET column_name = REGEXP_REPLACE(column_name, '$search', '$new') WHERE column_name REGEXP '$search'" )…

VIEW QUESTION

MySql Group by hour

i need to select only full hour values from a list of datetime entries. But if i select more columns, the group by hour doesn't work. So if i don't select the column "datetime" the group by works. SELECT datetime,…

VIEW QUESTION
Back To Top
Search