in reply to DBI SQL Query Question

This is a guess, as I can't use placeholders with Freetds/MS SQL Server/DBI, but do you have a quote problem? Should the query line look like this instead:
$UniqueDay = "SELECT count(*) as COUNT, max(time) as MAX, min(time) as + MIN, attacksignature from np_data where month=\'?\' and day=\'?\' gr +oup by attacksignature order by COUNT desc";
At any rate, look at $unique_events_sth->errstr for more info

Scott

Replies are listed 'Best First'.
Re: Re: DBI SQL Query Question
by ehdonhon (Curate) on Jan 11, 2002 at 23:40 UTC

    DBI always auto quotes placeholders. Which can be annoying if you want to use a placeholder to represent what you are selecting and not what you are comparing.

    ## You can do this, and not worry about quoting: $query = "SELECT x, y, z from table where a = ?"; ## This doesn't work the way you think it does: $query = "SELECT ? from table where a = 'blah'";

    In the case of the second example above, if you provided "field1" to be bound to the placeholder, you would get: SELECT "field1" from table where a = 'blah', which means you would get a bunch of results that all say "field1".