in reply to Pipe the Output of a SQL statement into the Input of another

Use something like:
select distinct (s.C) from TTTT as t, TTTT as s where something and s.A = t.A and s.B = t.B;
This is the SQL dialect that MySQL speaks. For Sybase, you would probably use something like:
select distinct (s.C) from TTTT.t, TTTT.s where something and s.A = t.A and s.B = t.B;
But I don't have a server to test this on.

You might want to edit the "something" to explicitely mention the table alias t.

Abigail