correct way for using joins when use len() sql server -
i need join 1 or 2 tables. 1 table have salary field. make calculations if field null means returns 0. use len(). can't access correct values. when use join before len() condition have result. result id column comes unorder 1,4,46,89,...something that. don't know why.
my query is,
cast(substring(cast(o.budget varchar(50)), 0, patindex('%laks%', o.budget))*100000 + substring(cast(o.budget varchar(50)), patindex('%laks%', o.budget) + 4, patindex('%thousands%', o.budget) - patindex('%laks%', o.budget) - 4)* 1000 varchar(50))+')' requirementsdetailsfororganization o right join requirementsregistereddetails r on r.registereddate=r.registereddate left join requirement_contact_details rc on rc.requirementid=o.requirementid **where len(o.budget)<>0**
in above code starred condition used. why shows types of values.
my output:
insert jobs(1,85000)
insert jobs(3,205000)
insert jobs(4,0(when null))
insert jobs(16,145000)
insert jobs(18,110000)
in previous result, bold values id. unordered , values missed within range of values when use len()
any 1 suggest me issue?
cast(substring(cast(o.budget varchar(50)), 0, patindex('%laks%', o.budget))*100000 + substring(cast(o.budget varchar(50)), patindex('%laks%', o.budget) + 4, patindex('%thousands%', o.budget) - patindex('%laks%', o.budget) - 4)* 1000 varchar(50))+')' requirementsdetailsfororganization o right join requirementsregistereddetails r on r.registereddate=r.registereddate left join requirement_contact_details rc on rc.requirementid=o.requirementid len(isnull(o.budget, ":d"))<>0
Comments
Post a Comment