Select Two Tables SQL in mendix

0
Hello,   I want to know if is possible to do that in mendix  'Select E.Name, T.Name,  E.StartDate, E.EndDate  from Estimate E, Technology T   where E.TechnologyId = T.Id    and StatusId = 2'   I have this error in the Execute Query object in a microflow : Caused by: com.mendix.modules.microflowengine.MicroflowException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.IllegalStateException: Duplicate key Name (attempted merging values Optional[TEST RRR] and Optional[Java])     at MyFirstModule.ExeQuery_Estimate (JavaAction : 'Execute query')   The problem is in obtain two columns with the same name.   Thanks  
asked
3 answers
1

Hello Roberto,

In mendix you join two tables like this by using the association like this.the R1 will be association between two tables

Select SAMP.*, COM.*

FROM


SAMPLING$SAMPLEREQUEST SAMP,
USERMANAGMENT$COMPANY COM,
SAMPLING$SAMPLEREQUEST_COMPANY R1

WHERE 

SAMP.id=R1.SAMPLING$SAMPLEREQUESTID 
and COM.id  =R1.USERMANAGMENT$COMPANYID

 

answered
1

You should think about if you really need this. In Mendix, you usually retrieve the main object and you are still able to display associated data (In grids, listviews,...)

answered
0

Have you tries using Aliases for the selected columns?

Nevertheless, seriously consider if you need to do a raw SQL query.

regards, Fabian

answered