It's a bad idea to mix SQL-89 (joining through using commas) and SQL-92
(using join) syntax, and I'm not used to using GROUP BY on fields used
in a calculation (although this may well be legal). And why do you use
LEFT JOIN TM when you refer to it in the WHERE clause as if it was an
INNER JOIN?
Please,
CREATE OR ALTER VIEW ESPELHO12(
CODEMPRESA,
CODFILIAL,
DTMOVPROD,
CODMOVIMENTO,
CODPRODUTO,
TIPOMOVIMENTO,
QUANTIDADE,
SALDO,
CFOP,
CODCOMPRA,
CODVENDA,
DESCRICAO,
NCM,
DOCUMENTO,
TIPOPR
Yes, you can, using an expression index
CREATE INDEX IDX_MYINDEX ON MY_TABLE COMPUTED BY (INVOICED - RECEIVED);
and your SELECT would be:
SELECT
*
FROM
MY_TABLE
WHERE
INVOICED - RECEIVED < 0
That way you will not need to create an additional column neither to do an
UPDATE neither to cr
I know that it was necessary to execute ALTER PROCEDURE for the parent
procedure if nested procedure was changed with ALTER PROCEDURE - that was in
the previous Firebird versions. Without parent alter there were cases when the
source code (that could be seen in RDB$ tables) of the nested procedu