Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting records that have not been previously selected

Status
Not open for further replies.

basildon

Programmer
Oct 22, 2001
58
GB
Hi

I have a database of company details which I supply to my customers (held on MySQL).

Sometimes customers want a top up of records matching their specification but, oviously, they don't want records that they have previously been sent.

Currently I extract the records using SQL and then use a Perl script to remove the previously sent records.

I'd like to know whether there is a quicker SQL based solution to this problem as this process is often repeated and I think could be dramatically improved.

Many Thanks for any help
 
The first thing that came to my mind was adding at least one extra field to your DB table(s) that stores a flag 'already_dloaded' with 0/1 as possible values.
On a second thought this is a rather suboptimal solution since you will problably have more than one customer downloading records. In any case seems you need another table that holds information like customer_id, already_dloaded and record_id (maybe as a foreign key). Somthing along these lines.
But I am not a database professional, so you might/will hopefully get better ideas from other users here ;-)

Regards,
Zodiak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top