My purpose is select w_id and w_name -fields from workstations table
and the latest date (s_started) from stat -table if workstations.w_clientversion=1 or statindex-table
if workstations.w_clientversion = 3.
Both tables (stat and statindex) have same structure.
I tried to run following select-clause :
(select max(s_started) from (
when 1 then [stats] else [statindex] end)) as latestdate
but i got an following error message:
'Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'case'.'
Is it anyhow possible to constitute conditional from -clause using case when structure?