Re: Using GROUP BY and COUNT
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 19 Dec 2012 13:38:06 -0500 Jeremy Livingston <[email protected]> wrote: > Pardon my ignorance, but I'm not sure how to specify that driver that > I'd like to use using bsqlodbc. Look again at my example. :-) It's not a driver I'm using. bsqlodbc is a FreeTDS command-line utility; it's found in src/apps and should have been installed somewhere like /usr/local/bin when you installed FreeTDS. The point is to determine if the problem you're seeing is in the FreeTDS ODBC driver (which the utility uses), or in the PHP module, or in your application. I think you'll find bsqlodbc runs your query just fine, which suggests the problem in not in the driver. > For example: "SELECT COUNT(MiddleName) FROM Person" > where MiddleName contains all null values will throw the error. You might try these, too: $ echo 'select count(t) from (select cast(NULL as int) as t) as T' \ | bsqlodbc -U$U -P$P -S$S ---------- 0 bsqlodbc: error 8153: 01003: [FreeTDS][SQL Server]Warning: Null value is eliminated by an aggregate or other SET operation. If I stack a guess on a few assumptions, the most likely problem is that the error message isn't handled correctly. For example, if PHP stops processing the resultset when the message arrives, and then continues to use the connection without fetching or cancelling the pending results, you would see an invalid-cursor-state error on the next query. HTH. --jkl