×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Currency not on a record - perv9.5 error ( works in Firebird)

Currency not on a record - perv9.5 error ( works in Firebird)

Currency not on a record - perv9.5 error ( works in Firebird)

(OP)
i get that error when running this SQL statement in pervasive 9.5

the object is to return 12 records with sum sales for each month, with a different column for last year and this year such that
salesperson, month, lastYTD, CurrYTD.

SELECT ARH.BKAR_INV_SLSP, MONTH(ARH.BKAR_INV_INVDTE) AS MO,
    ( SELECT
        SUM(ARH1.BKAR_INV_SUBTOT)
        FROM BKARHINV ARH1
        WHERE ARH1.BKAR_INV_SLSP=ARH.BKAR_INV_SLSP AND ( MONTH(ARH1.BKAR_INV_INVDTE) = MONTH(ARH.BKAR_INV_INVDTE) )
        AND (ARH.BKAR_INV_INVDTE>= '2005-01-01' AND ARH.BKAR_INV_INVDTE<= '2005-12-31')
    )AS LYTD,
    ( SELECT
        SUM(ARH2.BKAR_INV_SUBTOT)
        FROM BKARHINV ARH2
        WHERE ARH2.BKAR_INV_SLSP=ARH.BKAR_INV_SLSP AND ( MONTH(ARH2.BKAR_INV_INVDTE) = MONTH(ARH.BKAR_INV_INVDTE) )
        AND (ARH.BKAR_INV_INVDTE>= '2006-01-01' AND ARH.BKAR_INV_INVDTE<= '2006-12-31')
    )AS CYTD
FROM BKARHINV ARH
WHERE ARH.BKAR_INV_SLSP=25 AND (ARH.BKAR_INV_INVDTE>= '2005-01-01' AND ARH.BKAR_INV_INVDTE<= '2006-12-31')
GROUP BY ARH.BKAR_INV_SLSP, MONTH(ARH.BKAR_INV_INVDTE) #

i tested this for grins in a firebird database to see if my SQL was messed up. but it worked!so i'm sure it's the difference in SQL functions.

if i understand the error, i think because it's performing the subquery, once or twice doesn't matter, but the cursor, or knowing what record the db engine is reading gets CONFUSED, or LOST.

soooooo, does any one know of a way i can work around this? i plan on using it in a Stored Procedure and it must be in Pervasive 9.5

thank you for any ideas forthcoming!

dave

RE: Currency not on a record - perv9.5 error ( works in Firebird)

I would suggest opening a support ticket with Pervasive if you don't get any response.  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close