1. Multi-Criteria Enquiry subordinate All Data
SELECT * from Orgunit where (parentid = ' 3 ' or orgid= ' 3 "or ParentID in (select OrgId from Orgunit where parentid= ' 3 '))
2. of the same number of columns Multiple Query Results Combination (union All)
Select A,b,c from table1
UNION ALL
Select CA,CB,CC from Table2
3. Left outer connection with right outer connection (left jion, starboard jion)
The left JOIN keyword returns all rows from the table (TABLE_NAME1), even if there are no matching rows in the right table (table_name2).
Now we want to list all the people as well as their orders-if any.
You can use the following SELECT statement:
SELECT Persons.lastname, Persons.firstname, Orders.orderno from Persons
on ORDER by Persons.lastname
The right JOIN keyword returns all rows from the table (table_name2), even if there are no matching rows in the left table (table_name1).
Now, we want to list all the orders and the people who ordered them-if any.
You can use the following SELECT statement:
SELECT Persons.lastname, Persons.firstname, Orders.orderno from Persons right JOIN Orders on Persons.id_p=orders.id_p ORDER by Persons.lastname