Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9219129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:01:59+00:00 2026-06-18T03:01:59+00:00

This function that I have does what I want, but just wondering if there

  • 0

This function that I have does what I want, but just wondering if there is a way to do it in one go:

drop table ##aa
select s.storeid,cast(LEFT(p.paytype,1) as varchar(50)) as Paytype,SUM(amount) as Total
into ##aa
from RPTrs s, rpPay p
where s.storeid=p.StoreID and s.ReceiptNO=p.ReceiptNo 
and trsdate between '1/1/06' and '1/1/13'
group by s.storeid,LEFT(p.paytype,1)

update A set a.paytype=b.currencydesc
from ##aa a, Currencies b
where a.Paytype=b.POSCurrency

select * from ##aa order by Paytype, StoreID

What I am asking is, I want to apply the b.CurrencyDesc to the initial p.paytype. The Paytype just displays C as example but I want it to stand for Cash, and V for Visa and such as it is described in the Currencies table

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:02:02+00:00Added an answer on June 18, 2026 at 3:02 am

    Seems like you can add a JOIN:

    select   s.storeid
           , b.currencydesc as Paytype
           , SUM(amount)    as Total
    into     ##aa
    from     RPTrs s
    
    join     rpPay p
    on       s.storeid=p.StoreID
         and s.ReceiptNO=p.ReceiptNo
    
    join     Currencies b 
    on       b.POSCurrency=cast(LEFT(p.paytype,1) as varchar(50))
    
    where    trsdate between '1/1/06' and '1/1/13'
    group by s.storeid
           , b.currencydesc
    

    Converted to use explicit join syntax. Can’t tell what table contributes trsdate. And I’m not sure the CAST is needed on the join condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the story... I have a jQuery function that does something, this function is
I would like to have a mapping function that does this: public static void
I have this function that switches the HTML contents from one element on a
I have a function that usually returns one value. However, when there are multiple
Apologies if this is a silly question, but I'm just wondering the best way
So I have this function that forks N number of child processes. However it
I have this function that I would like to condense into some iterator. How
I have this function that prints the name of all the files in a
I have this function that converts all special chars to uppercase: function uc_latin1($str) {
I have this function that takes the input of a, runs a calculation and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.