Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
need help to sort out this issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: need help to sort out this issue
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

Senior Member


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

PostPosted: Wed Feb 27, 2013 12:31 pm    Post subject:
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

Site Director


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

PostPosted: Wed Feb 27, 2013 1:26 pm    Post subject:
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: 1013
Location: India

PostPosted: Thu Feb 28, 2013 9:34 am    Post subject:
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

Senior Member


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

PostPosted: Thu Feb 28, 2013 1:18 pm    Post subject:
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: 1013
Location: India

PostPosted: Thu Feb 28, 2013 1:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts SIGNAL ON HALT issue packerm CLIST & REXX 1 Fri Oct 20, 2017 6:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us