Gene Wirchenko wrote:
> <snip>
> However, your suggestion did get me thinking. (Thank you.) I
> had somehow blindsided myself and missed how to use a join to do
> it. Changing only the third select, I came up with:
>
> ***** Start of Included Code *****
> select funccode,clcode,wccode,max(validtil) as maxvt from cwkf;
> group by funccode,clcode,wccode;
> into cursor mvt
>
> select funccode,clcode,wccode,max(validtil) as currvt from cwkf;
> where validtil>={^2009.01.01} and validtil<={^2009.12.31};
> group by funccode,clcode,wccode;
> into cursor cvt
>
> select;
> cvt.funccode,cvt.clcode,cvt.wccode,cvt.currvt as validtil,;
> cvt.currvt=mvt.maxvt as ismax;
> from cvt;
> join mvt on;
> cvt.funccode=mvt.funccode and cvt.clcode=mvt.clcode and;
> cvt.wccode=mvt.wccode;
> order by cvt.funccode,cvt.clcode,cvt.wccode;
> into cursor truefalse
> ***** End of Included Code *****
>
> Thank you again.
>
>
Glad you got it working. Doesn't that 3rd select only give you codes
that have a max value in 2009?
What makes me think this is that you are joining a table of max values
(which could be this year or earlier) with a table of only 2009.
It's hard to visualise it without having some data to play with.
Cheers
Peter
----------------------------------------------------------------
Rajan Imports has changed - we are now Whispering Smith Ltd. For more
information see our website at www.whisperingsmith.com
Please update your address book with my new email address:
[email protected]
.
This communication is intended for the person or organisation to whom it is
addressed. The contents are confidential and may be protected in law.
Unauthorised use, copying or
disclosure of any of it may be unlawful. If you have received this message in
error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd
Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700
Fax:0161 831 3715
London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.