<?xml version="1.0" encoding="windows-1252"?>
<node id="849606" title="Re: SQl logic inPerl" created="2010-07-14 14:42:51" updated="2010-07-14 14:42:51">
<type id="11">
note</type>
<author id="803845">
brap</author>
<data>
<field name="doctext">
How about something along the lines of:
&lt;code&gt;
select name from mytable
  where acc = '12345' and
  year = (select max(year) from mytable where year in( $year, $year+1 ))
&lt;/code&gt;
The syntax is probably dependent on your database, though.</field>
<field name="root_node">
849572</field>
<field name="parent_node">
849572</field>
</data>
</node>
