<br><div class="gmail_quote">On Dec 3, 2007 1:49 AM, Larry Garfield &lt;<a href="mailto:larry@garfieldtech.com" target="_blank">larry@garfieldtech.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><br></div><br>As for in-SQL operations on the date value, like MONTH() or YEAR() in MySQL?<br>If someone has an idea for those that doesn&#39;t involve regexing every query I<br>would dearly love to hear it. :-)
<br><div><div></div></div></blockquote><div><br>The current use of UNIX timestamp is a compromise, and has its issues, but still allows in-SQL operations.<br><br>In-SQL operations is very very important. Going to ActiveRecord type of abstraction without the ability to do aggregate operations on the data is just not an option.
<br><br>Without in-SQL, doing things like:<br><br><div style="margin-left: 40px;">select n.nid, n.type, n.title, count(*) as num_votes, avg(value) as avg_vote from votingapi_vote v inner join node n on content_id = n.nid
 where 
n.type = &#39;image&#39; and n.created between unix_timestamp(&#39;2007-11-01 00:00:00&#39;) and unix_timestamp(&#39;2007-11-30 23:59:59&#39;) group by v.content_id having num_votes &gt; 1 order by avg_vote desc, num_votes desc limit 20;
<br></div><br>Would be  impossible, or would entail very expensive full table scans.<br></div></div>