[thelist] SQL multiple Joins?

Tris beertastic at gmail.com
Thu Nov 15 08:25:24 CST 2007

Is it possible to have multiple joins..

Ont eh query below. it failes.. Buuuut, if I limit it to one join, it
works great..
My database logs transactions and I'm trying to produce a report that
shows each transaction total, within a certain period.. (Oct and sept
so far..)

but it's cfalling over..
Anyhoo, off to google... race you!


	 SUM(activitiesSep.points) as sepPoints
	,SUM(activitiesOct.points) as octPoints

FROM `users`

RIGHT JOIN `activities` as `activitiesSep` on
	activitiesSep.UserID = users.ID
WHERE activitiesSep.`Timestamp` >= '1188604800' AND
activitiesSep.`Timestamp` <= '1191196799'

RIGHT JOIN `activities` as `activitiesOct` on
	activitiesOct.UserID = users.ID
WHERE activitiesOct.`Timestamp` >= '1191196800' AND
activitiesOct.`Timestamp` <= '1193875199'



Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others
to laugh at him.`
Thomas Szasz

More information about the thelist mailing list