Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Excel Query Wizard Date Query not working

Options
  • 15-08-2018 3:45pm
    #1
    Registered Users Posts: 691 ✭✭✭


    Hi

    So I inherited an excel sheet that has a query wizard query.

    The long and short of it is when run you get a date range prompt to filter the data by. It was working fine but now its not. When you run it now it runs but displays all the rows including ones outside the date range.

    SELECT slitemm.kind, slitemm.customer, slcustm.name, slitemm.dated, slitemm.item_no, slitemm.refernce, slcustem.ssdstate, slcustem.vatstate, slcustm.vat_type, slitemm.currency, slcustem.ecvatreg, slcustm.analysis_codes5, slitemm.analysis_codes2, slitemm.amount, slitemm.vat_amount, slitemm.currency_amount, slitemm.currency
    FROM firefly.scheme.slcustem slcustem, firefly.scheme.slcustm slcustm, firefly.scheme.slitemm slitemm
    WHERE slcustem.customer = slcustm.customer AND slitemm.customer = slcustem.customer AND slitemm.customer = slcustm.customer AND ((slitemm.kind='INV') AND (slitemm.dated>=? And slitemm.dated<=?) OR (slitemm.kind='CRN'))

    The affected bit is (slitemm.dated>=? And slitemm.dated<=?) I have also used "between" "and" but get the same issue. I know how to do it in SQL and i think it is something to do with teh formatting of the data but the cells are all set to date range. As I said it was working before which makes it strange.

    I should add this is a SQL query to a separate server the connection string is ok as it pulls the data fine.


Comments

  • Registered Users Posts: 773 ✭✭✭pillphil


    Are all the results (slitemm.kind='CRN'), this will ignore the dates (I think)


  • Registered Users Posts: 691 ✭✭✭$ausage$


    HI Phil I am not sure but I will try to remove the or.


  • Registered Users Posts: 691 ✭✭✭$ausage$


    HI Phil

    That looks to have been the issue. Its weird as i am not sure why they would have wanted that to be in there.


  • Registered Users Posts: 773 ✭✭✭pillphil


    Possibly meant

    ((slitemm.kind='INV' OR slitemm.kind='CRN') AND (slitemm.dated>=? And slitemm.dated<=?))

    That's just speculation though as i've no idea what the data are.


Advertisement