简体   繁体   中英

NHibernate queryover join tables

I have a question.. How to join two tables tah are related but not have direct relation constraint in nhibernate queryover?

Table1 { ID Title }

Table2 { ID VALUE ALIAS } Table1 and Table2 has not fk relationship constraint. Need to Do something like this:

Select Table1.Title, 
Table2.Alais 
from Table1
   inner join (Select Value from table2 where ALIAS = 'someAlias')
where Table1.ID = Table2.Value

Please help thanks.

Have you tried just using the where clause?

Select Table1.Title, Table2.Alais 
from Table1, Table2
where Table1.ID = Table2.Value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM