Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql Filter
Message
 
 
To
25/04/2001 15:41:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00499800
Message ID:
00499817
Views:
22
>I need help in structuring a query, if this is possible.
>
>Example - I have 6 records,
>
> Code Sequence Date
>
> abc 003 03/15/01
> abc 004 04/01/01
> abc 005 04/15/01
>
> xyz 004 04/01/01
> xyz 005 04/15/01
> xyz 006 05/01/01
>
>
>I need the result to be a distinct code with the lowest sequence beginning in April (or any specified month), so it would include only code 'xyz' and bypass 'abc' since it starts in March. I can code a program to do this, but I can't figure out a Select statement that will do it.
>
>Thanks
>
>Judy Scofield

Judy,
How about two SQL statements:

select code,min(date) as 'mindt' from sqltest group by code having month(mindt) >= 4 into cursor c_temp
select * from sqltest where code+transform(date) in (select code+transform(mindt) from c_temp)

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform