Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complex SQL Query With Join In Liftweb

Tags:

People also ask

What are complex joins in SQL?

A complex join in SQL is also referred to as an outer join. It is not necessarily more complex than an inner join. It is referred to as "complex" simply because SQL is conducting an inner join in addition to gathering a little more information from one or more tables.

Does join affect query performance?

Join order in SQL2008R2 server does unquestionably affect query performance, particularly in queries where there are a large number of table joins with where clauses applied against multiple tables. Although the join order is changed in optimisation, the optimiser does't try all possible join orders.

Can you join a table with a query?

Note: You can join queries in the same way that you join tables, and can also join both.

How do I join two joined tables in SQL?

The join is done by the JOIN operator. In the FROM clause, the name of the first table ( product ) is followed by a JOIN keyword then by the name of the second table ( category ). This is then followed by the keyword ON and by the condition for joining the rows from the different tables.


I would like to know if there is a way to do some complex SQL queries using Mapper in Liftweb.

In fact what I would like to do is to perform a Join query from databases Employes and Departments using the fact that they are linked by a 1-to-many relationship. Another example is also welcome.

Thanks in advance.


Here are some more details: Suppose I have 2 tables :

Employee : birthday, department ID, salary
Department : department ID, budget, address

Now I would like to obtain a list of the object Employee (created with Mapper) which have a salary > 10$ and a department budget < 100$.

Of course my original code is much more complicated than that but my objective is to be able to have a List of mapped objects (ie Employee) corresponding to criterions in its own table or on a linked table.