amvis:
Quote:
i have two tables, customer and transaction.Both have primary key as
id.The customer table have one field created_at. and the transaction
table have one field points.
I need to take the sum(points) from transaction but that will be the
created_at > "2010-12-11". But query gives error..... |
What query? What error? How do customer and transaction tables relate?
Quote:
how will take this using join....? |
Do you want the sum of all points of all customers that were created
after Dec.11, 2010?
SELECT sum(points) AS totalpoints
FROM transaction
INNER JOIN customer ON customer.id=transaction.cid
WHERE created_at > "2010-12-11"
assuming that transaction.cid is foreign key for customer.id
--
Erick