IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

need help to sort out this issue


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sampaul4u

New User


Joined: 27 Mar 2010
Posts: 19
Location: folirida

PostPosted: Wed Feb 27, 2013 12:22 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Feb 27, 2013 12:31 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 27, 2013 1:26 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Feb 28, 2013 9:34 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Feb 28, 2013 1:18 pm
Reply with quote

After looking at Sushanth's post, first post in this thread make sense; Thanks Sushanth.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Feb 28, 2013 1:22 pm
Reply with quote

You are Welcome Anuj
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top