Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl solution for SQL problem?

by rdfield (Priest)
on Jan 05, 2004 at 13:44 UTC ( #318842=note: print w/replies, xml ) Need Help??


in reply to Perl solution for SQL problem?

Use an "update" statement with a correlated sub-query, e.g.
update geo_m_count g set person_count = ( select count(*) from cases c where <as per OP> )
No Perl required.

rdfield

Replies are listed 'Best First'.
Re: Re: Perl solution for SQL problem?
by Corion (Pope) on Jan 05, 2004 at 14:23 UTC

    Unless denormalization is really needed, I wouldn't do this - I would either create a view or leave the query as a subselect, depending on the features of the underlying DB.

    Of course, it might be prudent to cache that information, as the database load will be not really small if queries hit person_count often, but I don't see Win hitting that part yet.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://318842]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2021-04-23 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?