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 157001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:25:33+00:00 2026-05-11T10:25:33+00:00

I have a table balances with the following columns: bank | account | date

  • 0

I have a table balances with the following columns:

bank | account | date | amount 

I also have a table accounts that has bank and account as its composite primary key.

I want to do a query like the following pseudocode:

select date, sum(amount) as amount from balances where  bank and account in (list of bank and account pairs) group by date 

The list of bank-account pairs is supplied by the client. How do I do this? Create a temp table and join on it?

I’m using Sybase

  • 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. 2026-05-11T10:25:34+00:00Added an answer on May 11, 2026 at 10:25 am

    If bank account pairs is known in you app you just write:

    (bank = 1 AND account = 2) OR (bank = 3 AND account = 4) OR ... 

    If list of bank account pairs is a subquery, then write something like this:

    SELECT * FROM balances b LEFT JOIN bank_account_pairs p ON ... WHERE b.bank = p.bank AND b.account = p.account AND ... 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table that has a list of transactions ID FromID ToId
I have an HTML/XML table generated by AJAX that displays limited columns of a
Let's assume that I have a table in a mysql database as follows, date
I have following data in a mysql table, +------------+--------+--------+ | date | inQty |
I have hasMany table that records transactions of purchases of users. I'm also about
i have a table as following: Account(Acc_number,Acc_balance,branch_code) Now i want to list all account
I have the following table -----Account#----Period-----Balance 12345---------200901-----$11554 12345---------200902-----$4353 12345 --------201004-----$34 12345 --------201005-----$44 12345---------201006-----$1454 45677---------200901-----$14454
I have the following schema for the generation of a table/model class named Account
I have a table called bank with three columns: uid , nick , balance
I have a table name transactions with following columns created_at | debit | credit

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.