Wednesday, 24 December 2014

MySQL Update example Using group by and Inner Join

	 UPDATE  tmpbilledsummary AS a 
INNER JOIN
( SELECT
a.practiceCode AS accountCode, b.name AS accountName, COUNT(*) AS counter
FROM
laborder a, practice b
WHERE
a.practiceCode = b.code
AND
a.DOS >= COALESCE(pFromDOS,DOS)
AND
a.DOS <= COALESCE(pToDOS,DOS)
GROUP BY a.practiceCode
) AS b
ON
a.accountCode = b.accountCode
SET a.clientOrders = b.counter;

6 comments:

  1. Wow, Fantastic Blog, it’s so helpful to me, and your blog is very good, I’ve learned a lot from your blog here, Keep on going, my friend; I will keep an eye on it.
    Herbal Potpourri

    ReplyDelete
  2. Shared here such a nice and useful blog here about healthcare.Keep updating more like this.

    ReplyDelete
  3. Nice blog you have initiated here. One can get solutions for health care. Keep posting this kind of stuff with time.

    ReplyDelete
  4. Nice Website...
    Hey JOIN now fblikesbot.com and Increase Facebook Likes your profile and websites.
    Increase Facebook Likes and check your website worth worth my websites
    its may be very beneficial for you also really

    ReplyDelete
  5. This blog post contains very useful information. I am very glad that I found this blog. Keep on sharing such useful information in future. k2 potpourri for sale

    ReplyDelete