Subject error in sql when I put distinct keyword
Author Ronaldo Rezende Vilela Luiz
Look for my query:
SELECT INSTITUICAO
, (SELECT NOME
FROM INSTITUICAO
WHERE INSTITUICAO.ID = CONTAS.INSTITUICAO)
AS NOME_INSTITUICAO
FROM CONTAS C, TIPO_CONTA_CREDITO T
WHERE C.TIPO=T.TIPO_CONTA AND TIPO_LANCAMENTO=:TIPO_LANCAMENTO
----------
PLAN (INSTITUICAO INDEX (RDB$PRIMARY9))
PLAN JOIN (T INDEX (RDB$FOREIGN54),C INDEX (RDB$19))
---------
There is more then one register that have the same value of field
INSTITUICAO in my result of query. When I try to put the DISTINCT (SELECT
DISTINCT INSTITUICAO), I receive this error: ISC ERROR CODE: 335544343 ISC
ERROR MESSAGE: invalid request BLR at offset 122 context alredy in use (BLR
error).
This error generated by Firebird or by ibo?

Is there any problem if a do this query in 3 tables. If there isn't any
disadvantage I make this select in table instituicao, because in this table,
the field that I want to be distinct is a primary key. And in the table
CONTAS, this field is a foreing key.

--
Ronaldo Rezende
ronaldim@...
-----------------------------------------
Analista e desenvolvedor de sistemas
e solu��es Desktop, Client / Server,
Internet, Intranet.
Uberaba, MG - Brasil
2� Per�odo de Sistemas de Informa��o
Universidade de Uberaba
....