View previous topic :: View next topic
|
Author |
Message |
Sarva_bubli
New User
Joined: 09 Aug 2006 Posts: 37 Location: Pune, India
|
|
|
|
Hi,
How to code not equal to in SQL query.....
May I have the explanation.... |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
Read the SQL reference manual, first.
Does this request "an explanation"?? !! Semantic? |
|
Back to top |
|
|
Madhu Reddy
New User
Joined: 28 Sep 2006 Posts: 56
|
|
|
|
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 |
|
|
Sarva_bubli
New User
Joined: 09 Aug 2006 Posts: 37 Location: Pune, India
|
|
|
|
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 |
|
|
MFRASHEED
Active User
Joined: 14 Jun 2005 Posts: 186 Location: USA
|
|
|
|
One more way of using NOT EQUAL is by using '<>'
Code: |
WHERE ACCT_ID <> ' '
|
|
|
Back to top |
|
|
Sarva_bubli
New User
Joined: 09 Aug 2006 Posts: 37 Location: Pune, India
|
|
|
|
Hi MFRASHEED,
Let me try with this way also. Thanks for the info. |
|
Back to top |
|
|
h.dinesh
New User
Joined: 06 Dec 2006 Posts: 46 Location: Chennai
|
|
|
|
Both <> and ?= is working but 'not equal to' is not working |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
DB2 V8 doesn't support "?" character, so a good idea to use "<>". |
|
Back to top |
|
|
Sarva_bubli
New User
Joined: 09 Aug 2006 Posts: 37 Location: Pune, India
|
|
|
|
Hi Dinesh & Priyesh,
thanks for the response.. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
Sarva_bubli
New User
Joined: 09 Aug 2006 Posts: 37 Location: Pune, India
|
|
|
|
Hi Dave,
Thanks for the additional info. |
|
Back to top |
|
|
|