View previous topic :: View next topic
|
Author |
Message |
sampaul4u
New User
Joined: 27 Mar 2010 Posts: 19 Location: folirida
|
|
|
|
Hi all,
I have a requirement in DB2.There are 2 tables called tab A and tab B with below colums.
Tab A
-------
Emp_Name
Emp_Age
Emp_Position
Tab B
------
company_name
Salary
Emp_Position
Here is my requirement i need to select Emp_name,Emp_Age and Salary.
Problem: while declaring the table(Tab A,Tab B) it gives problem due to common variable(Emp_Position).
please help me to sortout this issue?
Thanks
Paul |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Are you facing probelm in writing the SQL to get the desired data or declare (create) definition for tables is the problem? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to post the actual query along with the diagnostic information.
Also, there is likely an issue with the approach. Many positions have multiple salaries. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hello Paul,
When writing select query, you must give alias name, which can be give for a table or column.
select a.empname, a.emp_age, b.emp_position
from TABA as A, TABB as B
where a.emp_position = b.position
Regards,
Sushanth |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
After looking at Sushanth's post, first post in this thread make sense; Thanks Sushanth. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
You are Welcome Anuj |
|
Back to top |
|
|
|