query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onlyfaisal
    New Member
    • Feb 2008
    • 1

    query

    I have to query a from a table something like the following but its not working ???
    select invoice,right(i snull(code,'XXX XXXXX'),2) from invoice where invoicedate='20 08-01-04' .

    The code field is NULL in most of the results...
  • deepuv04
    Recognized Expert New Member
    • Nov 2007
    • 227

    #2
    Originally posted by onlyfaisal
    I have to query a from a table something like the following but its not working ???
    select invoice,right(i snull(code,'XXX XXXXX'),2) from invoice where invoicedate='20 08-01-04' .

    The code field is NULL in most of the results...
    HI,
    i think the problem is with the invoice date. probably it has the timestamp along with it and not comparing with the date give
    so find the date diff to compare the dates as follows

    select invoice,right(i snull(code,'XXX XXXXX'),2) from invoice where DATEDIFF(DD,inv oicedate,'2008-01-04') = 0

    hope will work

    thanks

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      Originally posted by onlyfaisal
      I have to query a from a table something like the following but its not working ???
      select invoice,right(i snull(code,'XXX XXXXX'),2) from invoice where invoicedate='20 08-01-04' .

      The code field is NULL in most of the results...

      What error are you getting?

      -- CK

      Comment

      Working...