<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Handling Multiple Checkbox Updates in SQL</title>
	<atom:link href="http://john.beynon.org.uk/2008/04/02/handling-multiple-checkbox-updates-in-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://john.beynon.org.uk/2008/04/02/handling-multiple-checkbox-updates-in-sql/</link>
	<description>Confessions of a code Junkie and anything else i fancy!</description>
	<lastBuildDate>Thu, 14 Jan 2010 03:02:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: johnb</title>
		<link>http://john.beynon.org.uk/2008/04/02/handling-multiple-checkbox-updates-in-sql/#comment-771</link>
		<dc:creator>johnb</dc:creator>
		<pubDate>Fri, 04 Apr 2008 15:48:36 +0000</pubDate>
		<guid isPermaLink="false">http://john.beynon.org.uk/index.cfm/2008/4/2/Handling-Multiple-Checkbox-Updates-in-SQL#comment-771</guid>
		<description>there i was over complicating the problem - good points patrick.

with regards to the delete, yeah - i mentioned that in the second to last paragraph, I intentionally ommitted it from my posted cost.</description>
		<content:encoded><![CDATA[<p>there i was over complicating the problem &#8211; good points patrick.</p>
<p>with regards to the delete, yeah &#8211; i mentioned that in the second to last paragraph, I intentionally ommitted it from my posted cost.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick McElhaney</title>
		<link>http://john.beynon.org.uk/2008/04/02/handling-multiple-checkbox-updates-in-sql/#comment-770</link>
		<dc:creator>Patrick McElhaney</dc:creator>
		<pubDate>Fri, 04 Apr 2008 15:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://john.beynon.org.uk/index.cfm/2008/4/2/Handling-Multiple-Checkbox-Updates-in-SQL#comment-770</guid>
		<description>I might be missing something in your code, but in case the user is already assigned to some groups, you need to handle clearing of checkboxes / removal from groups too.

begin transaction;

delete users_to_groups
where userid = #userid#

insert into users_to_groups
(userid, groupid)
select #userid#, groupid
from groups
where groupid in (#groupIDs#)

commit transaction;</description>
		<content:encoded><![CDATA[<p>I might be missing something in your code, but in case the user is already assigned to some groups, you need to handle clearing of checkboxes / removal from groups too.</p>
<p>begin transaction;</p>
<p>delete users_to_groups<br />
where userid = #userid#</p>
<p>insert into users_to_groups<br />
(userid, groupid)<br />
select #userid#, groupid<br />
from groups<br />
where groupid in (#groupIDs#)</p>
<p>commit transaction;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick McElhaney</title>
		<link>http://john.beynon.org.uk/2008/04/02/handling-multiple-checkbox-updates-in-sql/#comment-769</link>
		<dc:creator>Patrick McElhaney</dc:creator>
		<pubDate>Fri, 04 Apr 2008 15:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://john.beynon.org.uk/index.cfm/2008/4/2/Handling-Multiple-Checkbox-Updates-in-SQL#comment-769</guid>
		<description>I&#039;ve been doing something similar for a long time, sans the user defined function.

insert into users_to_groups
(userid, groupid)
select #userid#, groupid
from groups
where groupid in (#groupIDs#)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been doing something similar for a long time, sans the user defined function.</p>
<p>insert into users_to_groups<br />
(userid, groupid)<br />
select #userid#, groupid<br />
from groups<br />
where groupid in (#groupIDs#)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
