sql - Join not fetching data correctlly -
i have written procedure below lines of code.
select countryid, countryname, countrycode, longitude, latitude, createdby, createdon, updatedon, updatedby country c exists (select top 1 1 cause cs cs.countryname c.countryname ) basically there 2 tables country countryid , countryname fields , cause 3 fields: causeid, causename , countryname.
i trying fetch countries assigned cause. above code not working.
select * country c inner join cause cs on cs.countryname = c.countryname this countries have causes. hope understood wanted.
this works if cs.countryname identical c.countryname. mind fact exists takes longer join , consider indexing countryname column
Comments
Post a Comment