• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

SQL Query from diffrent tables - How to

Hi,

I have 3 databases like below;

DB1
MUSID : autoinc
...

DB2
TekID : autoinc
MUSID : number
...

DB3:
DB3ID : autoinc
TekID: number
Money : currency
MoneyID : number

I want to select the sum of money grouping by moneyid and MUSID.
That is like
MUSID  MoneyID  Sum of Money
-------------------------------------
1              1                100
1              2                150
2              1                98
...

How can i do that with sql code ? I'm programming with delphi and none of the tables hav relationship between.

Thanx..

MeCeX
0
mece
Asked:
mece
  • 2
1 Solution
 
SimonLarsenCommented:
select a.MusID, b.MoneyID, Sum(Money)
from db2 a join
db3 b
on a.tekid = b.tekid
Group by a.MusID, b.MoneyID

is the sql statement you are after if these are 3 tables which I am guessing is what you mean.
0
 
meceAuthor Commented:
thanx for the way

it works with left join command
i learned it

MeCeX
0
 
SimonLarsenCommented:
oh right cool, happy to help.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now