-1
I assembled the following Query - "INFORMIX"
SELECT COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90);
Which returns me the following error:
An error occurred when executing the SQL command: SELECT COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90);
A syntax error has occurred. [SQL State=42000, DB Errorcode=-201] 1 statement failed.
Execution time: 0.02s
I want to perform a Count in a table up to a specific value, even if you have more records, I just want to know if you have that specific quantity, in the example "90".
SELECT COUNT(*) FROM NOTA_FISCAL_NFE LIMIT 90;
– Roberto de Campos
The code you posted in the question does not match the code executed in the DBMS according to the error message:
SELECT TABLE_TESTE.COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90) AS TABLE_TESTE
. In the case of the code in the error message, you informedTABELA_TESTE.COUNT(1)
, which is really wrong. If you write as you asked it should work, although the subquery is unnecessary.– Diego Rafael Souza
So, worst that doesn’t work, but I updated the error now.
– Pedro Alencar
In terms of logic, your SQL doesn’t make much sense. It makes sense only because of a technical/performance limitation. But Informix has no performance problems when running
count(*)
, as with Oracle or Sql Server. All Count(*) are returned instantly because Informix maintains an online control of the number of rows in all tables. Can make Count simple without fear it will be fast:select count(*) from nota_fiscal_nfe;
– ceinmart