Skip to content
Advertisement

Tag: recursive-query

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,

MySQL query to find all child elements

I have two tables : elements : id_element name elem1 CPV elem2 CBO elem3 CPV parenting (Which is referencing elements) id_element id_element_elements elem1 null elem2 elem1 elem3 elem1 elem4 elem2 Is there a query to find all the child elements from a single element in this case ? Looking for something like : id_element id_child elem1 elem2 elem1 elem3 elem2

Hierarchical SQL query to Athena

I’m trying to create a query in Athena that solves this problem: I have records that look like this which create a hierarchical structure, like a tree but with indeterminate children. I have more than one root, that is, more than one element that is not children of anyone. I want to get the complete structure for one of them.

Advertisement