Hi,
I have 2 columns in Table1. I want to crate another table(Table2) having just the values of Column2 of Table1.
my Table1 is as:
Column1 Column2
12 13
14 15
16 18
133 122
I want my output for Table2 as:
Column
13
15
18
122
I tried with my code as:
my $sth = $dbh->prepare("INSERT INTO Table1 values (?,?)");
my $newtable = $dbh->prepare("CREATE Table Table2 Column VARCHAR(12)")
+;
while(<ARGV>)
{
.....
..
$sth->execute($words[0],$words[2]) or die $DBI::errstr;
$newtable ->execute("SELECT Column2 FROM Table1");
{print "$_";}
}
$sth->finish();
$newtable->finish();
$dbh->disconnect or warn $dbh->errstr;
But still am not able to create another table. Please guide me..
Thanks
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.