Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

prepare, execute and return the product - Perl DBI

by Freezer (Sexton)
on Sep 21, 2012 at 14:25 UTC ( #994914=perlquestion: print w/ replies, xml ) Need Help??
Freezer has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Basically. I had an SQL comand that made logical sense but ran very slowly on MySQL. So I converted it to 4 SQL statements instead, however extremely messy running those seperately in Perl
my $sql_count_A_Ref_inters_Comp = " DROP TABLE IF EXISTS e_annotation_090812.TEMP_reference_table; CREATE TABLE e_annotation_090812.TEMP_reference_table ( Key_m INT NOT NULL AUTO_INCREMENT, Entity_name_copy varchar(254) NOT NULL, PRIMARY KEY (Key_m) ); INSERT INTO e_annotation_090812.TEMP_reference_table (Entity_name_copy +) SELECT A.entity_name FROM e_annotation_090812.annotation A join e_annotation_090812.Temp_table T on T.Line=A.user where A.centre like '".$Reference."' and A.entity_name like '_%' and A.evidence_code not like '%_________8__'; SELECT '".$Reference."', '".$Comparitor."', A.entity_name, A.* FROM e_annotation_090812.annotation A join e_annotation_090812.Temp_table T on T.Line=A.user where A.entity_name like '_%' and A.evidence_code not like '%_________8__' and A.centre like '".$Comparitor."' and A.entity_name IN ( SELECT E.Entity_name_copy FROM e_annotation_090812.TEMP_reference_table E ); ";
Can I not just prepare, execute and return the products of the select statement in one go using Perl DBI? Maybe a different SQL query could do the trick.

Comment on prepare, execute and return the product - Perl DBI
Download Code
Replies are listed 'Best First'.
Re: prepare, execute and return the product - Perl DBI
by marto (Bishop) on Sep 21, 2012 at 14:37 UTC
Re: prepare, execute and return the product - Perl DBI
by Corion (Pope) on Sep 21, 2012 at 14:38 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (18)
As of 2015-07-07 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (92 votes), past polls