To make this useful, do something likeSELECT n.id FROM nodes n, meta_data md WHERE md.name = "color" AND md.value = "green" AND n.id = md.node_id ORDER BY 1
Placeholders are your friend.my $sql = <<'__END__'; SELECT n.id FROM nodes n, meta_data md WHERE md.name = ? AND md.value = ? AND n.id = md.node_id ORDER BY 1 __END__ my $sth = $dbh->prepare_cached($sql) || die $!; $sth->execute($attr, $value) || die $!; # Use your favorite fetch*() method here $sth->finish;
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In reply to Re: Querying Meta Data
by dragonchild
in thread Querying Meta Data
by eric256
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |