Hmmm....that is a bit trickier, as there is not an easy way to do that with sql (you could write a trigger, but that is an exercise left to the reader). What I might do in this situation is create a hash table and keep track of the number of times the first field has been seen. Some code (assume | delimited fields)
#!/bin/perl -w
use strict;
open(FILE,"myfile") or die "Couldn't open myfile";
my %first_record_hash;
while (<FILE>)
{
my @array = split '|';
if ($first_record_hash{$array[0]} < 6)
{
#insert record into database
$first_record_hash{$array[0]}++;
}
else
{
next;
}
}
I think that'll do the trick for you
|