I’m having hard time removing duplicates from database. It’s MariaDB (protocol version: 10, 10.3.34-MariaDB Server). I need to remove rows where three columns are equal. I was trying to use WITH clause but database throws error that it can’t recognize ‘WITH’, so I focused on traditional way. I need to remove rows where foreignId, column1 and column2 are equal. I’m
Tag: mysql
Mysql TRIM/RTRIM/REPLACE doesn’t work to remove trailing spaces from an email column
I have this insert select statement, copying data from employee bulk add staging to employee table: Even if I change it to RTRIM or REPLACE(eb.tr_email, ‘ ‘, ”) to replace the spaces with nothing it will still not modify the data to be inserted. I cannot get my login to work since my backend application detects these trailing white spaces
DELETE entry that is older than current datetime in MySQL
I have tried the following among various other statements but thought one of these should obviously work but no luck so far. Please tell me what I’m doing wrong. Not getting an error, it’s just not working. DELETE FROM table_name WHERE from < NOW() DELETE FROM table_name WHERE from < ‘2022-04-16 08:00:00’ Example Answer You shouldn’t name your columns (or
Join same two tables multiple times in one query [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question I have problem with my query and i can not figure it how to do it. What i want to do is to display “Ban By”
How to add a column to table results, with the number of repeats of a certain value on a row?
For example, we have a table: and I want to have a following output: Is there any way to do this? Answer Windowing functions are for that very purpose: We can’t tell if your particular database product supports window functions (you didn’t tell us)
SQL Query, What have I done wrong? I am fairly new to mySQL
Solution problem solution uploaded Answer You have to tell the count() function what to count. You can insert an individual column, or * for all of it etc. But you have to count something. This is a fiddle, showing how it works: https://www.db-fiddle.com/f/dbPnE4BXv8oRRkQY4WQs8v/1
how to extract and zip values from json with SQL, mysql
I struggle to extract the required values from the JSON column in MySQL. Imagine the variable: and I need to extract and return a new JSON array containing only selected key-value pairs, eg.: only a’s and b’s and if the required key does not exist I want to return null for that key: thanks Answer Here’s a solution using MySQL
How merge these two sql queries in mysql?
I want to merge below two queries and display two p_artist.id count based on the condition of each band name but I am not getting any clue. Can anyone help me, please? Thanks Answer I mean I want to have two-column of count ids The requirements are not clear at all and I had originally typed a separate answer, but
expected that this query will not output 0 values, but it does [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question I expected that this query will not output 0 values, but it does. I thought that and (…) > 0 will not output 0 values. So
SQL query with meta_key,meta_value and have 2 conditions
I am trying to do an SQL query to find a form id of the Registration form of the user on a wordpress site, because this form doesn’t have the id of the user yet, I have to find the user email which is unique and check if the gdprchekbox-1 is true because it is only used for the registering