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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:49:20+00:00 2026-06-16T04:49:20+00:00

I have two tables Registry ClientID Name Incube ———————- 1 Joe as 2 Jack

  • 0

I have two tables

Registry

ClientID  Name  Incube
----------------------
1         Joe    as
2         Jack   gt
3         Jor    ee

Deposit

DepositID  ClientID Quantum
----------------------------
1                1    100.45 
2                1    34.5
3                1    22.0
4                2    1000.0

I want to get only one result, this is
The Name, Incube from table Registry and the sum of all deposits made by that person all corresponfing to a certain ClientID

First I was doing 2 queries

SELECT [Name],[Incube] FROM Registry WHERE [ClientID] = 1;
SELECT DISTINCTROW Sum([Deposit].[Quantum]) As Total FROM Deposit WHERE [ClienteID] = 1;

then I did a left join to get all things more easy

SELECT 
[a].[ClientID],
[a].[Name],
[a].[Incube],
Sum([b].[Quantum]) as Total
FROM Registry a
LEFT JOIN Deposit b 
ON a.ClientID=b.ClientID 
group by a.Name, a.ClientID, a.Incube;

How do I filter de WHERE clause? I want to get all data of ClientID=1, NOT ALL, And the question here is how to only compute only the necessary ClientID and not all the clientsID?

  • 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-16T04:49:22+00:00Added an answer on June 16, 2026 at 4:49 am

    Unless I am missing something you just need to add the WHERE clause:

    SELECT 
      [a].[ClientID],
      [a].[Name],
      [a].[Incube],
      Sum([b].[Quantum]) as Total
    FROM Registry a
    LEFT JOIN Deposit b 
      ON a.ClientID=b.ClientID 
    where a.clientid = 1
    group by a.Name, a.ClientID, a.Incube;
    

    See SQL Fiddle with Demo

    The result is:

    | CLIENTID | NAME | INCUBE |  TOTAL |
    -------------------------------------
    |        1 |  Joe |     as | 156.95 |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables one with ID and NAME table 1 ID | NAME
I have two tables user table user_id | name | 1 | peter |
I have two tables: Holdings and Transactions Holdings data looks like: 06/30/2009, A, 100
I have two tables table1: { id, name } table2: { id, table1_id, time_added
I have two tables, like these: Table People: VARCHAR Name INTEGER Age Table Message
I have two tables ITEMS : id, name CATEGORIES: items_id, category I need to
I have two tables, like this: master --------- empcode INT PRIMARY KEY name VARCHAR
I have two tables like indicated below: Table1: name surname age ---- ------- ---
I have two tables images2 and image_data So the goal is to have 1
I have two tables 1.Products prod_id prod_name 1 honda 2 hero 3 marcedes 4

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.