Esteemed Monks,

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,
digger

P.S. - Platform is Win32, db is Access 2000 using Win32::ODBC interface.

In reply to Slightly OT - SQL Question by digger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.