给定一个包含3列的表:C1,C2,C3
C1 - C2 - C3 M - is - M1 N2 - is - N3 M2 - is - M3 M3 - is - M4 N1 - is - N2 M1 - is - M2 N - is - N1
如何将此Simple SQLServer语句转换为MySQL语句:
declare @searchString varchar(32) = 'M';
with cte(results) as
(
select C3 from Tbl where C1 = @searchString
union all
select t.C3 from Tbl t inner join cte c on c.C3 = t.C1
) select * from cte;