Problem with select statement where clause.
Pickering, John (NORBORD)
John.Pickering at norbord.com
Thu Apr 26 08:36:20 CDT 2007
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.
I'd work on the suggestion from yesterday requiring the testing of the concatenation of the two colomns.
Regards,
JWP
-----Original Message-----
From: powerh-l-bounces+john.pickering=norbord.com at lists.sowder.com <powerh-l-bounces+john.pickering=norbord.com at lists.sowder.com>
To: powerh-l at lists.sowder.com <powerh-l at lists.sowder.com>
Sent: Thu Apr 26 09:15:17 2007
Subject: RE: Problem with select statement where clause.
Greetings to the list,
Thanks to all those who responded, both on-list and off-list, to this call for help.
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.
// Use this when from_year and to_year are different.
select * from customer_analysis
where record_type = 3
and ((year_name = from_year and period >= from_period)
or (year_name = to_year and period <= to_period))
order by year_name, period
// Use this when the from_year and to_year are the same.
select * from customer_analysis
where record_type = 3
and ((year_name = from_year and period >= from_period)
and (year_name = to_year and period <= to_period))
order by year_name, period
regards,
Robert W.Mills
Systems Development Manager
Pinnacle Arvato
(020) 8309 3604
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20070426/46e899d9/attachment.htm
More information about the powerh-l
mailing list