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. Quote 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? Quote Link to comment https://forums.phpfreaks.com/topic/48362-join-after-sum/#findComment-236551 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.