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
 

 

Help in the following Query

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

New User


Joined: 05 Jul 2007
Posts: 16
Location: bangalore

PostPosted: Fri Oct 17, 2008 6:08 pm    Post subject: Help in the following Query
Reply with quote

Hi All i am exectuing the following query and i am getting some rows with a '-' in it. I need to remove the '-' from the results.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Fri Oct 17, 2008 6:13 pm    Post subject:
Reply with quote

Before the END) you could add ELSE ' '.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Oct 17, 2008 6:32 pm    Post subject: Reply to: Hi i need urgent Help in the following Query
Reply with quote

why post more than 1 megabyte of garbage ( jpegs )
when a palin text cut and paste would have taken at most 4000 bytes ???
2 screen of 24 lines each for 80 bytes ??
Back to top
View user's profile Send private message
loverj24

New User


Joined: 05 Jul 2007
Posts: 16
Location: bangalore

PostPosted: Fri Oct 17, 2008 6:33 pm    Post subject:
Reply with quote

Hi Robert,
Thanks for the reply.
By putting an ELSE the '-' disappered. But thats not the result i wanted. I need to elimate the Entire row where the status is blank.Kindly help
Back to top
View user's profile Send private message
loverj24

New User


Joined: 05 Jul 2007
Posts: 16
Location: bangalore

PostPosted: Fri Oct 17, 2008 6:34 pm    Post subject:
Reply with quote

Hi Enrico,

Sorry about taht will take care of it in the future.
Just wanted to give a relaistic picture of the issue
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Fri Oct 17, 2008 6:43 pm    Post subject:
Reply with quote

Stating
Quote:
remove the '-' from the results
is not the same as "remove the records with '-' in the results below" -- if you'd asked the right question first, that would have helped.

Since I'm not a DB2 person I can't tell you how to change the WHERE clause but the records with '-' (now space) either have CDREASON not = H or REG_TYPE not = 'H' or A.DTCREATE not = '2008-10-16' -- so you need to modify your SELECT to not pick those records.
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: Fri Oct 17, 2008 9:31 pm    Post subject:
Reply with quote

Hello,

The "screen" shots have been removed.

If you want that info back in the topic, use copy/paste and the "Code" tag to present information from a 3270-terminal.

Thank you.
Back to top
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Fri Oct 17, 2008 9:42 pm    Post subject:
Reply with quote

Hi

This is more specific to the Functionality and your application. Since we do not have any knowledge on your application and table usage, it would not be a more accurate answer what we provide here.

By looking at the result which you have given above,

You are specifically interested only on

1) REG_TYPE = 'H' and A.DTCREATE = '2008-10-16' Or
2) B.CDREASON = 'H'

When the retrieved records are not satisfy this condition, you are getting
'-' (No Value or NULL).

So to avoid these records, you can use the above condition in WHERE Clause of the query.


Code:
 
WHERE A.PERSONAL_ID = B.PERSONAL_ID
..................
.................
.................
AND ((REG_TYPE = 'H' AND A.DTCREATE = '2008-10-16')
 OR (B.CDREASON = 'H'))


This is just a tendative answer based on your output.

If it also does not satisfy your requirement, do please contact you team mates...

Suggestions are welcome
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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