Hi I Am Timbo Posted April 23, 2007 Share Posted April 23, 2007 Is there a way I can do a summed query with appropriate group bys that returns one value, then join a second table that would affect the sum (by having more than one row) after the sum. The result would be duplicate sums rather than a sum of duplicates. Link to comment https://forums.phpfreaks.com/topic/48362-join-after-sum/ Share on other sites More sharing options...
Wildbug Posted April 24, 2007 Share Posted April 24, 2007 I'm not sure I fully grasp your design, but I believe you can use a subselect to achieve this, if no other way. For instance: SELECT * FROM stuff AS t1 JOIN (SELECT availability,SUM(price) FROM stuff GROUP BY this) AS t2 ON t1.this=t2.this; The SUMs from the table will be joined to the same table on which category it represents. Is that what you want? Link to comment https://forums.phpfreaks.com/topic/48362-join-after-sum/#findComment-236551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.