Hallo,
mir persönlich sind verschachtelte Sub-Selects zu unübersichtlich. Common-Table-Expressions CTEs sind mir lieber, aber das ist bestimmt Geschmacksache.
Das obige Problem würde ich wie folgt lösen:
BirgittaPHP-Code:
with x as (Select CrtUsr as Name from Mytable
Union All
Select ChgUsr as Name from Mytable)
select Name, count(Name)
from x
group by Name
Bookmarks