Why does this work: SET @cnt = 0; SELECT (@cnt:=@cnt+1) AS ‘foo’, title FROM employee; But when I add ‘distinct’ keyword, it does not, while distinct works on its own (not shown). SET @cnt = 0; …
Tag: mariadb
i cant view all data when i using Datepicker on ‘WHERE’
hy, please help me,, i cant view all data from emp0003 to checking all employee absence.. emp0003 table NIK Name 01190301 Susan 01190302 Jamed dvc0004 table’s NIK Enroll 01190301 2021-02-03 08:…
Recursive query in tree MySQL8 / MariaDB10
I have a tree-like structure for categories on my database: create table cat( id int auto_increment primary key, url varchar(50), parent int references cat(id) ) How can i build the …
SQL, operation between paired rows
I have a table t1 a b 1 4 2 2 3 9 2 1 1 6 3 7 I need the output a result 1 4*6 2 2*1 3 9*7 I have been able to do it in a far from efficient way and would like a more …
MySQL – #1064 – Something is wrong in your syntax ‘LIMIT 0, 25’
Server: MariaDB, version 10.4.17 Query: Error in phpMyAdmin: Error in MySQL Workbench: All right so MariaDB decided to modify my query throw error that shouldn’t be thrown Let’s find out what is wrong with select something from (select 1, 2 as something) limit 123: I restarted the server and this error still occurs. Answer Both phpMyAdmin and MySQL Workbench will
What did I miss in this MariaDB query? I’m getting now a SQL syntax error
Every time I get Error: 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 ‘by, user, reason, active) VALUES (5, 663403380223377400, 793061601288388600, 274’. Did I miss something in the query? MariaDB version: 10.1.47 Kind Regards, CornĂ© Answer by is a reserved word in MySQL
MySQL: Select penult values
There are 2 tables: table1: id |phone| order| —|—–|——| 1 | 122 | 6 | 2 | 122 | 4 | 3 | 122 | 3 | 4 | 123 | 6 | 5 | 123 | 5 | 6 | 123 | 3 | 7 | 124 | 6 |…
MySQL – select distinct value from two column
I have a table with the following structure: How could I make a select statement on this table, which will return some rows of this table, where in each row, a specific id appears only one, indifferent on which column it is specified? For the above result set, I would like a query that would return: To give another example,
is there any way to insert an array values into INT datatype in SQL?
I am trying to insert into a table called Observations, I need to insert 10 rows using for loop, I have an array of 10 values that need to be inserted in a column called sens_value which is an INT type. I have tried the following code but it cant take sensValues[i] as an INT. I am using noodjs to
Counting unique pairs, but applying that count to all of its entries in SQL (not removing duplicates)
Let’s say I have a table: And I want my table output to be: but with the code I have here my output looks like this Any way I can create an sql query to is like my top table vs the one I make currently Using: 10.5.5-MariaDB Answer Use window functions: