in reply to Re: Compare items in DB
in thread Compare items in DB

Yes it worked, can this be for the reverse?

my $sth = $dbh->prepare( 'SELECT count(*) FROM num_table WHERE num <> +? +' );

Replies are listed 'Best First'.
Re^3: Compare items in DB
by kyle (Abbot) on Mar 05, 2008 at 20:51 UTC

    That will certainly do something, but I think it will be something you don't want.

    Consider a table with these numbers in it: (1, 2, 4, 5). If your number is 2 (which is present), and you select the count of numbers that do not match that, you get 3 (the non-matching numbers are 1, 4, 5). If your number is 3 (which is not present), and you select the same thing, you get 4 (every number there).

    What you want is to tell whether a given number is there or not. What you're suggesting is to count (or list) every number that isn't the given number.