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
 
how to compare between columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
naanu

New User


Joined: 02 Jun 2005
Posts: 3

PostPosted: Tue Jun 07, 2005 9:21 am    Post subject: how to compare between columns
Reply with quote

hi guys ,

suppose i have one table contain marks in all subjects and his/her name.

if i gave his/her name the result of the query should show the highest marks obtained by her/his in any subject

could you plz help me to write the query


Regads
naaanu
Back to top
View user's profile Send private message

Pushpak

New User


Joined: 06 May 2005
Posts: 18

PostPosted: Tue Jun 07, 2005 11:43 am    Post subject: Re: how to compare between columns
Reply with quote

Hi,

Could you please try following query?

SELECT NAME,SUBJECT,MARKS
FROM XYZ
WHERE NAME = 'A' AND
MARKS IN (
SELECT MAX(MARKS)
FROM XYZ
WHERE NAME = 'A'
);

Pushpak.
Back to top
View user's profile Send private message
naanu

New User


Joined: 02 Jun 2005
Posts: 3

PostPosted: Tue Jun 07, 2005 12:37 pm    Post subject: Re: how to compare between columns
Reply with quote

Pushpak wrote:
Hi,

Could you please try following query?

SELECT NAME,SUBJECT,MARKS
FROM XYZ
WHERE NAME = 'A' AND
MARKS IN (
SELECT MAX(MARKS)
FROM XYZ
WHERE NAME = 'A'
);

Pushpak.




sorry i think you have not understand the problem correctly

table has name column and subject column like


name mat sci sol lan lan2


my prob is if i gave the name i should get sub on which he got max marks
Back to top
View user's profile Send private message
Pushpak

New User


Joined: 06 May 2005
Posts: 18

PostPosted: Tue Jun 07, 2005 1:00 pm    Post subject:
Reply with quote

Hi,

Could you plz provide more detail ? Like Columns, Data & expected result with value.

Pushpak.
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 Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm

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