Sponsored Links
Sponsored Link

sponsored links

Collapse

Announcement

Collapse
No announcement yet.

ODBC / SQL to AS400 - where x <> 0 ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ODBC / SQL to AS400 - where x <> 0 ?

    Hello,

    Having a bit of an issue with a where clause on my ODBC to as/400 connection (currently using a DB Tool to check syntax then I port to VBA)

    Code:
    select CLNTTH, PAL#TH, TRDTTH, COMMTH, TRNCTH, TRTMTH, TRNQTH, USERTH, LOCNTH, WSIDTH from warhist
    where trdtth between 180104 and 180105 and
    clntth not like 'D2' AND
    progth in ('RDT181', 'RDT325', 'RDT781', 'RDT310') and
    Locnth not like '%%O'
    I get all the results, including 0 values on TRNQTH.

    So I added in;

    Code:
    select CLNTTH, PAL#TH, TRDTTH, COMMTH, TRNCTH, TRTMTH, TRNQTH, USERTH, LOCNTH, WSIDTH from warhist
    where trdtth between 180104 and 180105 and
    clntth not like 'D2' AND
    progth in ('RDT181', 'RDT325', 'RDT781', 'RDT310') and
    Locnth not like '%%O'
    
    and trnqth > 0
    I get no results

    Ive tried
    <> 0
    !=0
    - again no results.

    The field is transaction quantity, so it's an integer, so not like '0' etc won't work....

    Any one able to advise?
    Thanks

  • #2
    Try changing trnqth > 0 to trnqth = 0 to see if you at least get the zero value records. If that works, then try: not (trnqth = 0) and see if that works.

    Comment

    sponsored links

    Collapse

    Working...
    X