| Author |
Topic |
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 15:40:38
|
| case @namesflag when 3 then 1 else case @namesflag when 2 then names.new else names.old endend=1 I understand what it is doing for the second part when @namesflag=2 , but what does end=1 meanCan somebody please explain it to me.Thanks |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-16 : 15:44:24
|
| is end=1 not giving you syntax errorAshley Rhodes |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-16 : 15:45:55
|
| end = 1 compares the result of the case statement to 1.you have this case in your where clause, no?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 15:46:25
|
| No, it compiles fine |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-16 : 15:46:29
|
You better post full query. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 15:56:29
|
| spirit1,Yes, this was written by smebody else in foxpro view, I am trying to understand it,To answer your question yes it is in a where clause.so it compare the result of case, so when case is 3 then 1 end =1 is true, so goes thru the case again, can you please explain.Thanks a million |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 15:56:33
|
| spirit1,Yes, this was written by smebody else in foxpro view, I am trying to understand it,To answer your question yes it is in a where clause.so it compare the result of case, so when case is 3 then 1 end =1 is true, so goes thru the case again, can you please explain.Thanks a million |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 16:19:13
|
| I think i understood it, thanks spirit1 for your earlier answer to my question.case @namesflag when 3 then 1 else case @namesflag when 2 then names.new else names.oldendend=1 when @namesflag='3' then it sets to 1 and end =1 compares result to 1 , since it is true, exits, Thanks for your input spirit1 |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 16:19:17
|
| I think i understood it, thanks spirit1 for your earlier answer to my question.case @namesflag when 3 then 1 else case @namesflag when 2 then names.new else names.oldendend=1 when @namesflag='3' then it sets to 1 and end =1 compares result to 1 , since it is true, exits, Thanks for your input spirit1 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-16 : 16:23:21
|
No need for nested cases eithercase when @namesflag = 3 then 1 when @namesflag = 2 then names.newelse names.oldend=1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-16 : 16:24:33
|
WHERE @NamesFlag = 3 ÒR (@NamesFlag = 2 AND Names.New = 1) OR Names.Old = 1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-16 : 16:32:42
|
| wow, so it sets the values to 1, that's what end=1 does, would never have guessed it.Thanks Peso |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-17 : 04:40:58
|
| no it does ot set any values.it COMPARES them!_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|