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

Select Query which returns the single row


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

New User


Joined: 27 Nov 2006
Posts: 6
Location: india

PostPosted: Tue Jan 23, 2007 6:23 pm
Reply with quote

Hi,

assume there is a table student with Fields subject name and marks
s 10
s 20
s 30

the number of rows in the table may vary...
now i want an sql query which returns the single row which contain s 10 20 30 i.e only single row consist of all the marks for the subjest 's'
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 23, 2007 6:45 pm
Reply with quote

Rather unclear, just select columns where ____? Fill in the blank with the where clause.
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Wed Jan 24, 2007 12:05 am
Reply with quote

I guess what you are asking for is
a query to select values from one or more columns and
return it as one row, which i think is impossible.

For some reason, if you want this way
in your program to avoid the usage of cursor,
you can create a temporary table having one row with so many columns and (call a stored procedure) or (code sqls in your program) to update that temporary table with latest values. And then select it from that temporary table.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Jan 24, 2007 2:35 am
Reply with quote

Sameena,

What is the maximum number of scores a student can have?
Back to top
View user's profile Send private message
jinal_mca

New User


Joined: 05 Jan 2007
Posts: 22
Location: Pune, India

PostPosted: Wed Jan 24, 2007 12:30 pm
Reply with quote

Dear ur question is not clear ..
still i think if single row in ans u want u can do addition of all the marks with the help of aggregate function...
cya
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 RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top