IT will gives error But when we use single where clause its working and my response is But my problem is based on queryParm as userId we get data not all, so i added multiple where claues we get error please help me for that. Answer So AS you look at the error message it obviously said that the parameter
Tag: mariadb
Database row wont update when my TRIGGER fires. — “#1242 – Subquery returns more than 1 row”
I want to insert a new row on table ‘b’ when a column in table ‘a’ is updated. But when the trigger fires with UPDATE REQ SET status=’approved’ WHERE idReq=1; it throws an error saying: “#1242 – Subquery returns more than 1 row” Note: I am using MariaDB 🙂 Here is my TRIGGER: Answer My assumption reading your code is
How to SUM values of a column and then order by another column using SQL?
When I SELECT * FROM table; I have the following result: So I try to sum the total of votes with SUM(votes) as tt_votes and then group the result by candidate to have a desc order. state column shows the first (or the last?) record for the candidate, but what I’d really like to have is not only group by
How to move ID of duplicate names to a separate column
I have a MySQL table with two duplicate names, how can I separate the IDs of the duplicate names into a separate column? For example, like this: This is my current SQL statement to retrieve the current results in the first table: There is only one duplicate at most for each name. Thanks Answer If you are sure that the
Insert selected columns from one table to another SQL
I have two separate databases in the same host (localhost:3306). I have one table from the first database and a second from the other database. Here is 2 screenshots to become more clear I need to match: Is there any automatic way with a software? Need I to write some specific query to copy these 4 columns from one table
ID appears twice in query when multiplied with different Prices
I am trying to get the top 5 stations by Sales, but I ran into the problem that one station appears twice if multiplied by a different price. This is my query: Which gives me the following result: b_id START_PRICE 7 75 6 50 4 30 1 16 1 15 What i need though is: b_id START_PRICE 7 75 6
MySQL or MariaDB spread Date range in single row into multiple series of rows
Example tables are below, and example rows below, What I want to get is convert table above to below so that I can join using each date in range. Is there any way to extend date range in single row to series of Date row? Answer MariaDB 10.2+ or MySQL 8+ needed.
Get data from database and write it back in again
I have written a function by reading an excel file and writing it to the database. This works! Getting data from the database also works. Where I get stuck is at the point that the function should read each row, calculate it and write the result back to the database. I also want to find out how many rows were
How insert if a row not already exists ? (query)
My tables : Wrong migration script : I try insert new row if FirstTable.label == Str Test isn’t already exists but i get an error : SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ” at line 4 Update
MySQL JOINED table query should return zero but instead does not return those rows
I have two tables, saved_groups and user_comments and the second line of the query should (does, it works) return an extra column with the number of comments associated with each group. However, when a group has zero comments associated with it, that group is simply not returned. The only rows returned are those that have > 0 comments. Desired behavior