|Pathologically Eclectic Rubbish Lister|
Slightly OT - SQL Questionby digger (Friar)
|on Sep 20, 2003 at 11:48 UTC||Need Help??|
digger has asked for the wisdom of the Perl Monks concerning the following question:
I know this is not a SQL forum, but I also know many of you are very knowledgable in the ways of SQL. After googling fruitlessly (mostly because I am not quite sure what to search for) I decided to tap the incredible resources of perlmonks. Of course, the script I am working on is perl, so maybe I'm not completely OT.
I am working with a db that has a list of members and a list of counties they work in.
Members--(one to many)-->Counties
I am writing a little script that searches for members based on the county selected by the user. The syntax for that search is simple, and working. Now I need to go back and look at the counties table and get a list of all the other counties the member works in to display with their member info in my template.
The only method I can see at this point is to execute a SQL statement like SELECT County FROM Counties WHERE ID = $current_id for every row I fetch from my original query, and build the list from the hash returned.
My biggest concern here is performance. Right now, the longest search returns ~100 members, but as the list grows, will this scale, or slow my search to a crawl.
Am I already on the right track, or is there better, more efficient way to do this?
As always, I am very grateful for your help,
P.S. - Platform is Win32, db is Access 2000 using Win32::ODBC interface.