All Questions
Tagged with recursive-query mariadb
29 questions
0
votes
0
answers
56
views
MySQL 8.0 Query to MariaDB [duplicate]
I created the following query in MySQL 8.0, but when I try to add using phpMyAdmin I get the following error:
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that ...
0
votes
1
answer
54
views
MariaDB - Recursive Query with condition on last recursion level
given a MariaDB database with information about S/MIME certificates and the following database structure:
Table: cm_certificates
cm_id
cm_not_after
cm_issuer
cm_subject
cm_store_name
1
2028-09-20 08:...
2
votes
1
answer
174
views
Recursive query unexpectedly returning a blank value for one field
I have the following tables:
persons:
- personid: int not null
- personname: varchar(200) not null
parents:
- parentid: int not null
- personid: int not null
One person may have children, in which ...
3
votes
2
answers
574
views
Recursive query in MySQL for adjacency list depth first?
The table this query running on is roughly structured like this:
comments_table(PK id, FK reply_to_id, content)
FK is a self join on itself
It's running on 10.4.27-MariaDB
And the data looks ...
0
votes
1
answer
153
views
With clause, syntax error in recursive query
When running this query i get the 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 'WITH works as (SELECT ...
0
votes
1
answer
69
views
MySQL/MariaDB recursive statement, Return empty if children do not match condition
I have tables like this in the database:
Category
id_category
id_parent
level_depth
1
0
0
2
1
1
20
2
2
21
2
2
22
2
2
30
22
3
category_product
id_category
id_product
2
200
2
201
2
202
20
202
20
203
20
...
0
votes
1
answer
133
views
Fill in the missing hours with insert and recursive left join
I have a table with temperatures.
Sometimes the message was not received and the information is missing.
I need to fill the missing rows with NULL for every hour.
CREATE TABLE temp_total(
id int(6) ...
-1
votes
1
answer
734
views
MariaDB SQL WITH RECURSIVE AND UPDATE INNER JOIN
Query:
WITH RECURSIVE CTE AS(
SELECT 1 AS b, 10 AS a
UNION ALL
SELECT b+1, a+10 FROM CTE WHERE b < 5 )
UPDATE uptable a
INNER JOIN
(
SELECT b,a
FROM CTE
) c
ON a.a = c.b
SET a.a = c.a
...
0
votes
1
answer
160
views
Return empty recursive mysql if one of items not match with where
I have a recursive query that returns all elements until the parent element but I need it to not return any result if any of the elements has the active = 0.
organigram table:
idElement
idClient
...
0
votes
1
answer
59
views
MySQL - select distinct value from two column
I have a table with the following structure:
IdM|IdS
-------
1 | 2
1 | 3
1 | 4
2 | 1
2 | 3
2 | 4
3 | 1
3 | 2
3 | 3
3 | 4
How could I make a select statement on this table, which will return ...
0
votes
1
answer
1k
views
error in your SQL syntax, MariaDB server version for the right syntax to use near 'CREATE PROCEDURE pro()
DELIMITER $$
use adventureworks
CREATE PROCEDURE pro()
BEGIN
DECLARE i int DEFAULT 0;
WHILE i <= 50 DO
INSERT INTO salesorderheader(SalesOrderID, RevisionNumber, OrderDate)
...
1
vote
1
answer
120
views
Select keys connected by its values
I have two columns something like keys and values.
I need group keys regarding connections between values like is shown in picture. The same values connects keys.
I have no idea how to do it. Using 10....
1
vote
1
answer
373
views
SQL CTE recursive with multiple iterations
I have issues understanding CTE recursive. Let's say I want to calculate binomial coefficient. My guess is I need two CTEs as I want to have one that generates table with all values in some range (for ...
9
votes
5
answers
12k
views
SQL (Maria DB) split string separated by comma to rows
I have this column:
names
John, Mary
Joseph
Eleanor, Sophia, Dani
And I want this output:
names
John
Mary
Joseph
Eleanor
Sophia
Dani
And it should include the SUBSTRING_INDEX function
1
vote
2
answers
54
views
Viewing the date_column with different hours in a table in Mysql
I have a table called shift where I want to view the sdate column with the date followed by the start_time of the shift. Essentially, I am trying to split this sdate for managers LB1 and AE1 into 6 ...