Skip to content

Tag: left-join

MySQL tree structure

Hello i am trying to prepare tree structure with MySql, tables look something like this. My Question is: Is it possible to do left join and sort columns by name, but if in lang is eq to “fra” return that row with that name, otherwise return “eng” name. Pseudo code So final result will …

Simple PostgreSQL Self Join

This is what my employee table looks like where manager_id is Foreign Key to the same table it references to employee_id and indicates which employee has manager and who is. I did self left join and the result was what was expected. But this query gives me So I don’t understand why it returns something …

select conditionally with conditional joins in mysql

I am trying to join two tables, people and sales, and displaying results based on a where condition which should be used to join the tables. My current attempt is showing only one result but I want all the rows in the people to be shown regardless of whether they have a record in the sales table, if they have