I am hoping to find a simple SQL solution to my question. I have searched for one, but have been unable to find anything that works for my situation.
I have a .dbf with client data, consisting of customer names, addresses and other information, to be used for a commercial mailing. Each record gets assigned to a group, or package, and each package will be mailed separately. Occasionally I need to pull out records from one or more groups, into a new dbf, to set up as client seeds, updating them with new names and addresses, so the client will get a copy of the letter in the mail. Typically it's only one or two groups, in which case I can simply pick the first record, or find two sequential records that belong to different groups. Currently I have a file with 6 groups, and I need a single record from each group.
Basically I want to do the following, but I know this command doesn't work.
select * from customer group by package into table seeds
One way of doing this would be to do the following:
use customer
index on package unique
set order to package
copy to seeds
delete tag all
Alternatively, I could copy one record from each group into separate files, then append them to a single seed file.
Is there a way to get a single record from each group using a sql select statement?