#!/usr/bin/perl use strict; use warnings; use SQL::Abstract; use CGI; my $cgi = new CGI; my $sql = SQL::Abstract->new; my @tables = ('users'); my %where = ('users.geschlecht' => 'w'); if ($cgi->param('nur_user_mit_bild')) { push @tables, 'fotos'; $where{'fotos.user_id'} = \'= users.id'; } my ($sth, @bind) = $sql->select(\@tables, 'users.id', \%where); print $sth,"\n"; #SELECT users.id FROM users WHERE ( users.geschlecht = ? )