Error! Firebird prepare query error:Dynamic SQL Error SQL error code = -206 Column unknown D.DOC_SIGNATURE At line 1, column 479 select "DOCUMENTS".*,"DOC_TYPEFK$S"."DISPLAY" as "DOC_TYPEFK_D","DOC_CATEGORYFK$S"."DISPLAY" as "DOC_CATEGORYFK_D","SCHOOLSFK$S"."DISPLAY" as "SCHOOLSFK_D","GOVERNMENT$S"."DISPLAY" as "GOVERNMENT_D","ORGFK$S"."DISPLAY" as "ORGFK_D","ORG$S"."DISPLAY" as "ORG_D","DOC_LEVELFK$S"."DISPLAY" as "DOC_LEVELFK_D","DOC_STATE$S"."DISPLAY" as "DOC_STATE_D","DOCUMENTS"."SYS_GUID" as "DOCS_GUID","DOCUMENTS"."FILE","DOCUMENTS"."DOC_TYPEFK","BL"."REC_GUID","BL"."FILENAME","BL"."SYS_GUID" as "FOTO_GUID","D"."DOC_SIGNATURE","D"."DOC_SIGN_POST","D"."SYS_UPDATED" as "DOC_UPDATE" from "DOCUMENTS" left join (select "DOC_TYPE"."SYS_GUID" as "$SYS_GUID",(coalesce("DOC_TYPE"."NAME",' ')) as "DISPLAY" from "DOC_TYPE" where mod(coalesce("DOC_TYPE"."SYS_STATE",0),2)=0 ) as "DOC_TYPEFK$S" on ("DOC_TYPEFK$S"."$SYS_GUID"="DOCUMENTS"."DOC_TYPEFK") left join (select "DOC_CATEGORY"."SYS_GUID" as "$SYS_GUID",(coalesce("DOC_CATEGORY"."NAME",' ')) as "DISPLAY" from "DOC_CATEGORY" where mod(coalesce("DOC_CATEGORY"."SYS_STATE",0),2)=0 ) as "DOC_CATEGORYFK$S" on ("DOC_CATEGORYFK$S"."$SYS_GUID"="DOCUMENTS"."DOC_CATEGORYFK") left join (select "SCHOOLS"."SYS_GUID" as "$SYS_GUID",(coalesce("SCHOOLS"."SHORTNAME",' ')) as "DISPLAY" from "SCHOOLS" where mod(coalesce("SCHOOLS"."SYS_STATE",0),2)=0 ) as "SCHOOLSFK$S" on ("SCHOOLSFK$S"."$SYS_GUID"="DOCUMENTS"."SCHOOLSFK") left join (select "GOVERNMENTS"."SYS_GUID" as "$SYS_GUID",(coalesce("GOVERNMENTS"."GOVERNMENTNAME",' ')) as "DISPLAY" from "GOVERNMENTS" where mod(coalesce("GOVERNMENTS"."SYS_STATE",0),2)=0 ) as "GOVERNMENT$S" on ("GOVERNMENT$S"."$SYS_GUID"="DOCUMENTS"."GOVERNMENT") left join (select "ORGS"."SYS_GUID" as "$SYS_GUID",(coalesce("ORGS"."SOCR_NAME",' ')) as "DISPLAY" from "ORGS" where mod(coalesce("ORGS"."SYS_STATE",0),2)=0 ) as "ORGFK$S" on ("ORGFK$S"."$SYS_GUID"="DOCUMENTS"."ORGFK") left join (select "DOC_ORG"."SYS_GUID" as "$SYS_GUID",(coalesce("DOC_ORG"."ORG_NAME",' ')) as "DISPLAY" from "DOC_ORG" where mod(coalesce("DOC_ORG"."SYS_STATE",0),2)=0 ) as "ORG$S" on ("ORG$S"."$SYS_GUID"="DOCUMENTS"."ORG") left join (select "DOC_LEVEL"."SYS_GUID" as "$SYS_GUID",(coalesce("DOC_LEVEL"."NAME",' ')) as "DISPLAY" from "DOC_LEVEL" where mod(coalesce("DOC_LEVEL"."SYS_STATE",0),2)=0 ) as "DOC_LEVELFK$S" on ("DOC_LEVELFK$S"."$SYS_GUID"="DOCUMENTS"."DOC_LEVELFK") left join (select "DOC_STATES"."SYS_GUID" as "$SYS_GUID",(coalesce("DOC_STATES"."NAME",' ')) as "DISPLAY" from "DOC_STATES" where mod(coalesce("DOC_STATES"."SYS_STATE",0),2)=0 ) as "DOC_STATE$S" on ("DOC_STATE$S"."$SYS_GUID"="DOCUMENTS"."DOC_STATE") left join "SYS_BLOBS" as "BL" on ("DOCUMENTS"."SYS_GUID"="BL"."REC_GUID") where mod(coalesce("DOCUMENTS"."SYS_STATE",0),2)=0 and ("DOCUMENTS"."SCHOOLSFK"= ?) and ("DOCUMENTS"."DOC_TYPEFK" in ('33','34','35')) and (mod(coalesce("BL"."SYS_STATE",0),2) = 0) order by "DOC_DATE"