0

I would like to join two tables in one. I first are totals sums and in secound is partial sums.

result

something | total | month
xxxx      |  100  |  20
yyyy      |  125  |  45

data

goods|price|month
xxx  |5    |2
xxx  |8    |2
yyy  |3    |3

Is possible use WHERE on one colomn?

Barmar
  • 741,623
  • 53
  • 500
  • 612
p.pr
  • 1
  • You said two tables, but only posted one table and results. – Barmar Nov 25 '14 at 19:17
  • Are these both input tables? If so, what should the results be? What is the relationship between the two tables that you want to join them on? What does `WHERE` have to do with this? – Barmar Nov 25 '14 at 19:19
  • possible duplicate of [Calculate a running total in MySQL](http://stackoverflow.com/questions/664700/calculate-a-running-total-in-mysql) – Wrikken Nov 25 '14 at 19:20
  • what is total, and what is month? – vp_arth Nov 25 '14 at 19:22
  • I thought that i can have two separate table of results. one from `SELECT count(price) FROM ... GROUP BY goods` and secound the same with `WHERE month=2` on end. But I'd like to make one query. – p.pr Nov 25 '14 at 21:10

0 Answers0