1

If I use any condition apart from SELECT * whilst querying an Access DB with ODBC I get the following error: No tuples available at this result index

Any ideas ? Here's the particular GROUP BY query:

$result = odbc_exec($this->connection, "SELECT * FROM MyTable GROUP BY MyColumn");
odbc_result_all($result);

EDIT

After running the query directly from mdbtools' command line tool, I get the following:

Error at Line : syntax error near GROUP
  • 2
    That is invalid MS Access SQL, you cannot group by fields selected with *. – Fionnuala Mar 05 '12 at 12:02
  • Hmm, SELECT MyColumn FROM MyTable GROUP BY MyColumn returns the same error though.... –  Mar 05 '12 at 12:08
  • I do not think that is an MS Access error, did you see http://forums.devshed.com/php-development-5/ms-access-odbc-result-all-403027.html ? – Fionnuala Mar 05 '12 at 12:12
  • Updated the description after discovering the mdbtools error... –  Mar 05 '12 at 13:56
  • Did you use * when testing with mdbtools? – Fionnuala Mar 05 '12 at 13:57
  • Did you use the same field for both group by and select? It does not give a syntax error in Access, but it does give an error, which a simple `select mycolumn from mytable group by mycolumn` does not. – Fionnuala Mar 05 '12 at 14:19
  • yep, used the same field. Also, a WHERE clause only works on integers. i.e. if you use Strings (even with the single quotes), it returns no result. I think the mdbtools library is buggy. –  Mar 05 '12 at 14:24
  • You might like to change your question title, because it does not seem to be relevant any longer. It might help get an answer. – Fionnuala Mar 05 '12 at 14:27

0 Answers0