0

How to use max() in aggregate functions with 2 or 3 tables in it ?? give an example.

7th Jul 2016, 7:23 AM
Sandeep reddy
Sandeep reddy - avatar
2 Antworten
0
not sure I get what you're asking, but I'll try to answer. let's say you want to select field1 from table1 and max(field2) from table2. you need to have a relationship between the 2 tables that will go in the where clause and you have to end your select statement with the group by clause. for example:
7th Jul 2016, 11:30 PM
Gamer Girl
Gamer Girl - avatar
0
select dept, max(salary) from dept_table, emp_table where dept_table.id_dept=emp_table.id_dept group by dept;
7th Jul 2016, 11:31 PM
Gamer Girl
Gamer Girl - avatar