Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread LIST and DISTINCT
Fri, Sep 26 2008 3:18 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Is there a way of doing something like this

SELECT DISTINCT LIST(CAST(_fkCompanies AS VARCHAR)) _Restrict FROM Calls WHERE _fkProjects = 3

I want just the distinct _fkCompanies in the LIST eg the table might contain 1,2,4,2,1,6,7,8,1,2 etc and I want 1,2,4,6,7,8

Roy Lambert
Fri, Sep 26 2008 5:51 PMPermanent Link

"Jan-Erik Johansen"
"Roy Lambert" wrote
> Is there a way of doing something like this
>
> SELECT DISTINCT LIST(CAST(_fkCompanies AS VARCHAR)) _Restrict FROM Calls
> WHERE _fkProjects = 3
>
> I want just the distinct _fkCompanies in the LIST eg the table might
> contain 1,2,4,2,1,6,7,8,1,2 etc and I want 1,2,4,6,7,8
>

You could solve this by using a derived table

e.g.

select list(cast(somefield as varchar(8))) from
( select distinct somefield from sometable where ..... order by somefield
) as somederivedname

--
Jan-Erik
Sat, Sep 27 2008 5:20 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jan-Erik


Neat - thanks

Roy Lambert
Image