$sql =~ s/AND$//; [download]
In reply to Re: Composing a SQL statement by busunsl in thread Composing a SQL statement by maderman