Document for Table Joins


#1

would like to join 2-3 Tables for reports. However not getting any document with sufficient example. please let us know if any such document/Blog are available.

If i can get sample SQL for below, may be that will help me write more complex

Table1- Dept
EMP_ID
Expereince

Table2 - EMP
EMP_ID
Name

How i can get output for Name and Experience.

tried Below but not worked
select a.Name, b.Experience from emp a, dept b where a.emp_id=b.emp_id;

/sumit


#2

Hi

We use standard sql sytnax for the join.

eg:

mapdql> create table dept (emp_id int, experience text);
mapdql> create table emp (emp_id int, name text);
mapdql> insert into dept values (1,'c++');
mapdql> insert into emp values (1,'homer');

implicit join

mapdql> select a.name, b.experience from emp a, dept b where a.emp_id = b.emp_id;
name|experience
homer|c++

explicit join

mapdql> select a.name, b.experience from emp a join dept b on a.emp_id = b.emp_id;
name|experience
homer|c++
mapdql> 

What was the issue reported with that sql. It looks fine.

Can you share the ddl of the tables.

regards


#3

@dwayneberry
Thanks for a lot for sharing the details and will start verifying the Join queries.