<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Amyst Design Company &#187; MySQL</title>
	<atom:link href="http://amystdesign.com/blog/category/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://amystdesign.com/blog</link>
	<description>Company Blog</description>
	<lastBuildDate>Sat, 03 Apr 2010 17:09:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>MySQL Select the first and last ID from a table in a single select statement</title>
		<link>http://amystdesign.com/blog/mysql/mysql-select-the-first-and-last-id-from-a-table-in-a-single-select-statement</link>
		<comments>http://amystdesign.com/blog/mysql/mysql-select-the-first-and-last-id-from-a-table-in-a-single-select-statement#comments</comments>
		<pubDate>Fri, 16 Oct 2009 01:17:10 +0000</pubDate>
		<dc:creator>Doug Linsmeyer</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://amystdesign.com/blog/?p=102</guid>
		<description><![CDATA[Just a very quick little snippet that will allow you to SELECT the lowest and highest value from a single field in a database. For example, in a recent project I had to ensure that I was not deleting the first or last record status history record for a given project in a database table. [...]]]></description>
			<content:encoded><![CDATA[<p>Just a very quick little snippet that will allow you to SELECT the lowest and highest value from a single field in a database. For example, in a recent project I had to ensure that I was not deleting the first or last record status history record for a given project in a database table. To do this I came up with the following:</p>
<pre class="brush: sql;">
SELECT
	MIN(status_history_id) as first_id,
	MAX(status_history_id) as last_id
FROM table_status_history
WHERE ( project_id = &quot;some_unique_id&quot; )
GROUP BY project_id;
</pre>
<p>Essentially, this selects all status history records from the table for a specific project, then we group them all together and select only the max and min from the ID field and return those as (2) ad-hoc fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://amystdesign.com/blog/mysql/mysql-select-the-first-and-last-id-from-a-table-in-a-single-select-statement/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a mysql update query to increment a field</title>
		<link>http://amystdesign.com/blog/mysql/update-query-increment-field</link>
		<comments>http://amystdesign.com/blog/mysql/update-query-increment-field#comments</comments>
		<pubDate>Sat, 21 Feb 2009 17:25:29 +0000</pubDate>
		<dc:creator>Doug Linsmeyer</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://amystdesign.com/blog/?p=1</guid>
		<description><![CDATA[How many of us have had to increment a MySQL field and done a select query to get the current value, use PHP or another language to increment it, then turn right back around and run an update query. This little snippet of code will save you two of those steps, and save precious time [...]]]></description>
			<content:encoded><![CDATA[<p>How many of us have had to increment a MySQL field and done a select query to get the current value, use PHP or another language to increment it, then turn right back around and run an update query.</p>
<p>This little snippet of code will save you two of those steps, and save precious time doing it.</p>
<p>MySQL, being as beautifully simple and functional as it is, will let you increment a field via SQL, no reason to use another language to do it. The snippet below is the query in it its simplest terms.</p>
<pre class="brush: sql;">
UPDATE
    table_name
SET
    field_to_increment = field_to_increment + 1
WHERE
   ( id_field =  'some_id' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://amystdesign.com/blog/mysql/update-query-increment-field/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
