This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > October 2005 > Select distinct
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Alejandro 2005-10-12, 10:19 pm |
| got the following error . May i know how to do "distinct" on text field ?
1> SELECT DISTINCT s.id, s.new, s.modified, s.deleted, s.archived,
s.published,
s.approved, s.submitted, s.checkedOut, s.aclId, s.parentId, s.ordering,
s.templa
te, s.publishVersion, w.className, w.version, w.name, w.description,
w.summary,
w.author, w.date, w.related FROM cms_content_status s LEFT JOIN
cms_content_work
w ON s.id=w.id
2> go
Msg 421, Level 16, State 2:
Server 'LOCALHSOT', Line 1:
TEXT, IMAGE, UNITEXT and off-row Java datatypes may not be selected as
DISTINCT.
1>
I just want to make sure I don't get duplicates for the s.id field, which is
the ID of the table.
Any help is appreciated.
MS SQL 2000
| |
| bregent 2005-10-13, 3:15 am |
| I'm not sure about the error. But if s.id is the ID of the table, how could you have duplicates to worry about?
| |
| Alejandro 2005-10-13, 3:15 am |
| Because the query has joins to other tables with multiple results for each
item in table # 1.
The problem is that one of the fields is a text, therefore the error.
A
"bregent" <webforumsuser@macromedia.com> wrote in message
news:dikln7$d1v$1@forums.macromedia.com...
> I'm not sure about the error. But if s.id is the ID of the table, how
> could you have duplicates to worry about?
| |
| Lionstone 2005-10-13, 6:17 pm |
| You simply can't do that. What are your desired results? If you have a
join that produces more than one row, it won't truly be a duplicate because
the joined-in information will be different. If you're not selecting any of
that information, then perhaps there's no need for that table to be joined
in at all.
Help us understand your goal.
"Alejandro" <axiaxi2003@hotmail.com> wrote in message
news:dikfgu$5vr$1@forums.macromedia.com...
> got the following error . May i know how to do "distinct" on text field ?
>
>
> 1> SELECT DISTINCT s.id, s.new, s.modified, s.deleted, s.archived,
> s.published,
> s.approved, s.submitted, s.checkedOut, s.aclId, s.parentId, s.ordering,
> s.templa
> te, s.publishVersion, w.className, w.version, w.name, w.description,
> w.summary,
> w.author, w.date, w.related FROM cms_content_status s LEFT JOIN
> cms_content_work
> w ON s.id=w.id
> 2> go
> Msg 421, Level 16, State 2:
> Server 'LOCALHSOT', Line 1:
> TEXT, IMAGE, UNITEXT and off-row Java datatypes may not be selected as
> DISTINCT.
> 1>
>
>
> I just want to make sure I don't get duplicates for the s.id field, which
> is the ID of the table.
>
> Any help is appreciated.
>
> MS SQL 2000
>
| |
| bregent 2005-10-13, 6:20 pm |
| That's understood. It just looks to me that with all of the additional columns
you're pulling from the cms_content_work table, you're gonna end up with
duplicate s.id's regardless of whether you use the distinct keyword or not. Of
course, I don't know your data so it's just a guess.
Originally posted by: Newsgroup User
Because the query has joins to other tables with multiple results for each
item in table # 1.
The problem is that one of the fields is a text, therefore the error.
A
"bregent" <webforumsuser@macromedia.com> wrote in message
news:Dikln7$d1v$1@forums.macromedia.com...
> I'm not sure about the error. But if s.id is the ID of the table, how
> could you have duplicates to worry about?
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|