If the date, item, and category are the same in the table, I’d like to treat it as the same row and return n rows out of them(ex: if n is 3, then limit 0, 3). expected results (if n is 3) The problem is that I have to bring the values of each group as well. If I have
Tag: mysql
SQL | C# – Reader rows
I have a small problem with MySqlDataReader. I have data in MySql and I have column “name” and X rows under. Reader reads sucessfully all of this but output is in one string and looks like “FirtSecondThird” but i need all of this words in list word by word. The code is: Does anyone kno…
Can’t remove duplicates from MariaDB 10
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 trad…
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…
How calculate the max area from random point in a MYSQL table
I have a table with this data : x,y column 0 0,1 2,5 2,5 1,2 1 (they are random points) with this point how can i get the biggest area posible. Sample: select area(ST_GEOMFROMTEXT( ‘POLYGON( (0 0,1 3,5 3,5 1,3 1,0 0) )’ )) = 10 select area(ST_GEOMFROMTEXT( ‘POLYGON( (0 0,1 3,5 3,5 1,0 0) )&#…
MySQL query fails on syntax [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 4 m…
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 < ‘…
How can combine rows of a table with sql?
I have a table like this: Type rank A 1 A 2 B 3 A 4 B 5 B 6 B 7 A 8 And i want convert it to this table with sql query: Type rank A 2 B 3 A 4 B 7 A 8 How can I do this with and with out window functions? Answer It
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 di…
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)