Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Execessive parameter issue Sumeendar JCL & VSAM 5 Mon Dec 19, 2016 4:35 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts DFHRESPONSE returns issue divated CICS 3 Wed Nov 02, 2016 6:32 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us