EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Naresh Mehta on April 23, 2019, 10:45:16 PM



Title: How display Datagrid two different column value joining with same Master table
Post by: Naresh Mehta on April 23, 2019, 10:45:16 PM
I have tabel Details table contain field1 and field2 both having value of Master table id and text, now how display this value in datagrid.

e,g

Master Table               Details Table                                  Result Need in Datagrid
Id           Text              Field1       Field2

1            John                 1             2                                 John          Embross       
2            Embross           2             1                                 Embross     John 
3            Peter                3             1                                 Peter          John       

if I have change in select command pls. help me
my sql is select * from details where field1= id and field2 = id but it is not giving me any value.


Naresh

   


Title: Re: How display Datagrid two different column value joining with same Master table
Post by: thecyberzone on April 30, 2019, 04:40:04 AM
Just use following sql as query ...

select b.Text as field1detail,c.Text as field2detail from Details a
left join Master b on a.field1 = b.Id
left join Master c on a.field2 = c.Id

Have a check.