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.

In reply to prepare, execute and return the product - Perl DBI by Freezer

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.