-3
Case
when a.name and a.rownum=1 <> b.name and (b.namereason isnull or b.namereason in ('') and b.rownum=1 then a.name
when when a.name and a.rownum=1 <> b.name and (b.namereason isnotnull or b.namereason not in ('')) and b.rownum=1 then b.name
END as name

Note: I want to compare 2 tables.

A.RowNum = is take the max date

B.rownum = is take min date

I want compare the name if got update in B, then display B else display A.

I'm dealing with 10m+ records, cannot hardcode it. I need it to be working for generally.

i got error when doing something like this. error message is An expression of non-boolean type specified in a context where a condition is expected

any idea how to do something like?

3
  • when a.name and - you should write a condition for example when a.name = 'aaa' and ' ...
    – Sabin B
    Commented Mar 7, 2019 at 10:19
  • @sabin im deal with 10m+ records. Maybe i could come out with a.name is/is not null. I will try it later. Commented Mar 7, 2019 at 10:34
  • 1
    For a quick (and possible better) answer, you should supplies sample data, with desired output.
    – Sabin B
    Commented Mar 7, 2019 at 10:37

1 Answer 1

2

1) The code (pseudo) you posted is so badly indented. Please fix it for readability, and you should see why the error might be arising.

a.rownum=1 <> b.name

2) Can you please explain in plain simple words and illustrate with examples?

Not the answer you're looking for? Browse other questions tagged or ask your own question.