How can I select distinct rows when a text field is part of the returned fields in MS SQL Server 2000?

This should do it: SELECT s. Id, s. Title, s.

Desc FROM Section as s WHERE EXISTS (SELECT * FROM Quest-Ans as q where q. Sec_id = s. Id).

Select s. Id, s. Title, s.

Desc from Section s inner join (select distinct sec_id from Quest-Ans) dqa on s. Id = dqa. Sec_id.

Try it: SELECT s. Title, s. Desc FROM Section as s INNER JOIN ( SELECT DISTINCT s.Id FROM Section as s INNER JOIN Quest-Ans as q ON s.

Id = q. Sec_id ) q ON s.Id = q.Id.

Ekeko - That should be SELECT DISTINCT s.id. – Lieven Apr 2 '09 at 15:26 Returns a row for every question. – cdeszaq Apr 2 '09 at 15:26 @Lieven: Select returns a set of rows, and a set has not repetead elements and inner join is done based on the key (I guess).

So, distinct is not necessary. – eKek0 Apr 2 '09 at 15:41 @Ekeko, without DISTINCT, it gives 1 row per question. With, it works correctly.It is necessary.

– cdeszaq Apr 2 '09 at 15:43 @cdeszaq: That is what you want – eKek0 Apr 2 '09 at 15:45.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions