SQLTeam.com | Weblogs | Forums

Query to show balance on specific accounts

Hi, i'm trying to create a query that shows the balance on a large amount of accounts

so i have one table that shows sort code, account number, customer id

another table that shows current balance and customer ID

Theres millions of accounts and i need to find the current balance on about a 1000 of them

I've been able to write a query that joins the tables and shows the result for one account but if i try a where and/or for all 1000 accounts it doesn't work

any help on how i should go about writing this query would be much appreciated

Thanks

Post at least the table names and the columns that join them

hi

table1 = sort code , account_number , customer_id

table2 = current_balance , customer_id

select
table2.current_balance, table2.customer_id
from
( select * from table1 where account_number in those wanted 1000)
join
( select * from table2 where account_number in those wanted 1000 )
on table1.customerid = table2.customerid

hope it helps :slight_smile::slight_smile: