I have a table called settings
in that there are two columns and data like following.
settings value
------- ------
depots 12
projectid 156
client icici bank
clientvisits 2
DBname icicibank
progress true
displayvisits 2
visitsskipped 0
Here , the values of rows clientvisits
and displayvisits
should be same always.
I want a query which display the only these two fields along with values if their values are different. That means if clientvisits=2 and displayvisits=4
then it should throw an error (I mean it should display the output along with values).
I tried by using self join like this but it is not working.
select * from settings TS,settings TS1
where TS.settings=TS1.settings and CONVERT(integer,ts.value)=1
select * from settings TS,settings TS1
where TS.settings=TS1.settings and ts.setting like 'visitstodisplay'=1
Also, I tried to do some thing else but I didn't get. Please let me know how to do it.