<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>Re: Problem with select statement where clause.</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>This will work when from-year and to-year are equal or consecutive but will not work if they are farther apart. Please try your new code for a range like 200501 through 200706.<BR>
<BR>
I'd work on the suggestion from yesterday requiring the testing of the concatenation of the two colomns.<BR>
<BR>
Regards,<BR>
JWP<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: powerh-l-bounces+john.pickering=norbord.com@lists.sowder.com &lt;powerh-l-bounces+john.pickering=norbord.com@lists.sowder.com&gt;<BR>
To: powerh-l@lists.sowder.com &lt;powerh-l@lists.sowder.com&gt;<BR>
Sent: Thu Apr 26 09:15:17 2007<BR>
Subject: RE: Problem with select statement where clause.<BR>
<BR>
Greetings to the list,<BR>
<BR>
Thanks to all those who responded, both on-list and off-list, to this call for help.<BR>
<BR>
It looks as if the solution is to have two selects. One for where the from_year and to_year are different and another for where they are the same.<BR>
<BR>
// Use this when from_year and to_year are different.<BR>
select * from customer_analysis<BR>
where record_type = 3<BR>
&nbsp; and ((year_name = from_year and period &gt;= from_period)<BR>
&nbsp;&nbsp;&nbsp; or (year_name = to_year and period &lt;= to_period))<BR>
order by year_name, period<BR>
<BR>
<BR>
<BR>
// Use this when the from_year and to_year are the same.<BR>
select * from customer_analysis<BR>
where record_type = 3<BR>
&nbsp; and ((year_name = from_year and period &gt;= from_period)<BR>
&nbsp;&nbsp; and (year_name = to_year and period &lt;= to_period))<BR>
order by year_name, period<BR>
<BR>
<BR>
<BR>
regards,<BR>
&nbsp;<BR>
Robert W.Mills<BR>
Systems Development Manager<BR>
Pinnacle Arvato<BR>
(020) 8309 3604<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>