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
 

 

How to code not equal to in SQL query

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

New User


Joined: 09 Aug 2006
Posts: 37
Location: Pune, India

PostPosted: Mon Dec 04, 2006 1:17 am    Post subject: How to code not equal to in SQL query
Reply with quote

Hi,
How to code not equal to in SQL query.....
May I have the explanation....
Back to top
View user's profile Send private message

PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Mon Dec 04, 2006 3:38 am    Post subject:
Reply with quote

Read the SQL reference manual, first.

Does this request "an explanation"?? !! Semantic?
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Mon Dec 04, 2006 9:35 am    Post subject: Re: How to code not equal to in SQL query
Reply with quote

we need to code as not equal to

for example

select * from table where column1 not equal to zero.

as query please reply
Back to top
View user's profile Send private message
Sarva_bubli

New User


Joined: 09 Aug 2006
Posts: 37
Location: Pune, India

PostPosted: Wed Dec 06, 2006 7:14 pm    Post subject:
Reply with quote

Hi Madhu,
I got the answer. For example select Ac number from Cust table
EXEC SQL
SELECT ACCT_NO
INTO :EOP675ACCT-NO,
FROM EOP_AC_TABL
WHERE CUST_NO = XXXXXXXX
AND WIP-ID ? = 'D'
END-EXEC

Here WIP-ID not = 'D'. The not ( ? )symbol can be given as such.

Correct me if I'm wrong.
Back to top
View user's profile Send private message
MFRASHEED

Active User


Joined: 14 Jun 2005
Posts: 186
Location: USA

PostPosted: Wed Dec 06, 2006 10:07 pm    Post subject: Re: How to code not equal to in SQL query
Reply with quote

One more way of using NOT EQUAL is by using '<>'

Code:

WHERE ACCT_ID <> ' '

Back to top
View user's profile Send private message
Sarva_bubli

New User


Joined: 09 Aug 2006
Posts: 37
Location: Pune, India

PostPosted: Thu Dec 07, 2006 12:02 pm    Post subject:
Reply with quote

Hi MFRASHEED,
Let me try with this way also. Thanks for the info.
Back to top
View user's profile Send private message
h.dinesh

New User


Joined: 06 Dec 2006
Posts: 46
Location: Chennai

PostPosted: Thu Dec 07, 2006 2:38 pm    Post subject:
Reply with quote

Both <> and ?= is working but 'not equal to' is not working
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Dec 08, 2006 6:17 am    Post subject: Re: How to code not equal to in SQL query
Reply with quote

DB2 V8 doesn't support "?" character, so a good idea to use "<>".
Back to top
View user's profile Send private message
Sarva_bubli

New User


Joined: 09 Aug 2006
Posts: 37
Location: Pune, India

PostPosted: Mon Dec 11, 2006 7:32 pm    Post subject:
Reply with quote

Hi Dinesh & Priyesh,
thanks for the response..
Back to top
View user's profile Send private message
DavidatK

Active Member


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

PostPosted: Tue Dec 12, 2006 4:18 am    Post subject: Re: How to code not equal to in SQL query
Reply with quote

One additional consideration when coding not equal ?<>? is that if you are tying to compare against a null, you will not get a ?true? condition. Therefore you will need to code as follows:

Code:

WHERE COL_1 <> ?ABC?
   OR COL-1 IS NULL


Dave
Back to top
View user's profile Send private message
Sarva_bubli

New User


Joined: 09 Aug 2006
Posts: 37
Location: Pune, India

PostPosted: Fri Dec 15, 2006 9:42 am    Post subject:
Reply with quote

Hi Dave,
Thanks for the additional info.
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 UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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