Subject Re: [IBO] error in sql when I put distinct keyword
Author Luiz
----- Original Message -----
From: "Ronaldo Rezende Vilela Luiz" <ronaldinho79@...>
> 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.

Your query is bad. This is a FB error.
You must to use another query to achieve what you want.

Luiz.