On 30-5-2014 19:29, jose isaias cabrera wrote:
"Igor Tandetnik" wrote...

On 5/30/2014 12:41 PM, jose isaias cabrera wrote:
What should be returned is
the value of vEmail of the first record that has Xtra4='y'

What do you mean by "first record"? Records are processed in no
particular order.

Good point.  I was, wrongly, thinking that it was top to bottom with the
id. So, the idea is that once Xtra4='y' has provided a value, that is
what I want.  So, I think that because I am always getting 'noemail'
then, it is caused because the last record read had Xtra4!='y'.  So,
this is not properly giving the result desired.  So, how can I change this,

       CASE Xtra4 WHEN 'y' THEN vEmail ELSE 'noemail' END,

so that once I have a value from Xtra4='y', I want to keep that value as
the result.  Thanks.

sqlite> create table t(x);
sqlite> insert into t values(1),(2),(3);
sqlite> select x from t;
1
2
3
sqlite> select x, case when (select 1 from t where x=2) then 'Y' else 'N' end from t;
1|Y
2|Y
3|Y
sqlite>

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to