Dear everybody hope someone can help me!!

Im trying to SUM data from 2 different tabels without any ID connection between and I what to subtract the results from eachother afterwards.. how do i do that.

lets say i have tabel1.costs and tabel2.profit
I would like to SUM the data from the two tabels and then subtract the results from eachother..?? Possible?

Im running MS SQL 2005

Best regards from Kristian

Select
(
  Select Sum(Costs)
  From Table1
)
-
(
  Select Sum(Profit)
  From Table2
) As RetainedEarnings

thanks for your quick reply - i have been working for hours and hours trying to solve it.. with all sorts of UNION and Union all statements..thanks.. I have marked it at solved.. hope thats the right thing to do

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.