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 Profile Log in to check your private messages Log in
 
Select Query which returns the single row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Select Query which returns the single row
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 23, 2007 6:45 pm    Post subject:
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    Post subject: Re: Select Query which returns the single row
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    Post subject: Re: Select Query which returns the single row
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: 23
Location: Pune, India

PostPosted: Wed Jan 24, 2007 12:30 pm    Post subject: hi
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    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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm

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