hello,
I want to do a join of 3 tables using a "customSQL" ,Could you give me the right syntax please ?
my application does not start even with this mistake!
here is my code:
I want to do a join of 3 tables using a "customSQL" ,Could you give me the right syntax please ?
my application does not start even with this mistake!
here is my code:
Code:
<DataSource dbName="SQLServer_CRM" dataSourceVersion="1" serverType="sql" > <fields> <field name="OBJ_ID" type="int" title="OBJ ID" customSQL="true"> <nativeName>crm_obj_idnum</nativeName> <tableName>crm_objects</tableName> </field> </fields> <operationBindings> <operationBindings operationType="fetch"> <customSQL> SELECT OBJ_DET.[crm_obj_idnum] AS OBJ_ID ,OBJ_DET.[crm_obj_kind] AS OBJ_KIND ,OBJ_KN.[crm_kind_name] AS OBJ_KIND_NAME ,OBJ_FATHER.crm_obj_name AS FATHER_NAME ,OBJ_DET.[crm_obj_parent_idnum] AS FATHER_ID ,OBJ_DET.[crm_obj_name] AS OBJ_NAME ,OBJ_DET.[crm_obj_desc] AS OBJ_DESC ,OBJ_DET.[crm_obj_isactive] AS OBJ_ACTIVE fROM [foveaprocess_easycrm].[dbo].[crm_objects] OBJ_DET, [foveaprocess_easycrm].[dbo].[crm_objects] OBJ_FATHER, [foveaprocess_easycrm].[dbo].[crm_kind] OBJ_KN WHERE OBJ_DET.crm_obj_parent_idnum=OBJ_FATHER.crm_obj_idnum AND OBJ_DET.crm_obj_kind = OBJ_KN.crm_kind_idnum UNION ALL SELECT [crm_attrdat_fk_obj_idnum] AS OBJ_ID ,OBJ_FATHER_DATA.crm_obj_kind AS OBJ_KIND ,OBJ_KN.[crm_kind_name] AS OBJ_KIND_NAME ,OBJ_FATHER_DATA.crm_obj_name AS FATHER_NAME ,[crm_attrdat_fk_obj_idnum] AS FATHER_ID ,case OBJ_ATTR_DATA.crm_attr_datatype WHEN 'A' THEN [crm_attrdat_data_A1] END AS OBJ_NAME ,OBJ_ATTR_DATA.crm_attr_name AS OBJ_DESC ,[crm_attrdat_isactive] AS OBJ_ACTIVE FROM [foveaprocess_easycrm].[dbo].[crm_attrdata] OBJ_DATA, [foveaprocess_easycrm].[dbo].[crm_attributs] OBJ_ATTR_DATA, [foveaprocess_easycrm].[dbo].[crm_objects] OBJ_FATHER_DATA, [foveaprocess_easycrm].[dbo].[crm_kind] OBJ_KN WHERE OBJ_DATA.crm_attrdat_fk_attr_idnum=OBJ_ATTR_DATA.crm_attr_idnum AND OBJ_DATA.crm_attrdat_fk_obj_idnum=OBJ_FATHER_DATA.crm_obj_idnum AND OBJ_ATTR_DATA.crm_attr_fk_kind_idnum = OBJ_KN.crm_kind_idnum </customSQL> </operationBindings> </operationBindings> </DataSource>
Comment