|
| [MS SQL 7] GROUP BY - på bit-kolonne Fra : Jesper Stocholm |
Dato : 23-05-01 14:33 |
|
Er der nogen mulighed for at lave en GROUP BY på en bit-kolonne - enten ved
en omvej eller ved at konvertere det til fx. smallint ? Jeg har prøvet med
SELECT firstname, lastname, CAST(ignorant as smallint) AS ignorant
FROM table
GROUP BY firstname, lastname, male
men den brokker sig stadig over at der prøves at gruppere på en bit-
kolonne.
?
--
Jesper Stocholm
Systems Analyst
Copenhagen, Denmark
| |
Jesper Stocholm (23-05-2001)
| Kommentar Fra : Jesper Stocholm |
Dato : 23-05-01 14:59 |
|
spam@stocholm.dk (Jesper Stocholm) wrote in
<Xns90AA9E3C31AFDspamstocholmdk@153.80.109.11>:
>SELECT firstname, lastname, CAST(ignorant as smallint) AS ignorant
>FROM table
>GROUP BY firstname, lastname, male
det skulle selvfølgelig være denne SELECT:
SELECT firstname, lastname, CAST(ignorant as smallint) AS ignorant
FROM table
GROUP BY firstname, lastname, ignorant
--
Jesper Stocholm
Systems Analyst
Copenhagen, Denmark
| |
JH (23-05-2001)
| Kommentar Fra : JH |
Dato : 23-05-01 15:31 |
|
> Er der nogen mulighed for at lave en GROUP BY på en bit-kolonne
Lidt copy&paste.....
Note: You cannot use GROUP BY or HAVING on ntext, text, image, or bit
columns unless they are in a function that returns a value having
another data type, such as SUBSTRING or CAST.
| |
Jesper Stocholm (24-05-2001)
| Kommentar Fra : Jesper Stocholm |
Dato : 24-05-01 19:57 |
|
JH <jimmy@dk2net.dk> wrote in <8cingt0o3a6t18n414nmbrsfd5772tnaea@4ax.com>:
>> Er der nogen mulighed for at lave en GROUP BY på en bit-kolonne
>
>Lidt copy&paste.....
>
>Note: You cannot use GROUP BY or HAVING on ntext, text, image, or bit
>columns unless they are in a function that returns a value having
>another data type, such as SUBSTRING or CAST.
>
ja ... og det var også det jeg prøvede at komme ud over i min SQL-statement
med anvendelsen af
SELECT firstname, lastname, CAST(ignorant as smallint) AS ignorant
FROM table
GROUP BY firstname, lastname, ignorant
, hvor feltet ignorant er en bit-kolonne ... men forsøges
konverteret/CAST'et til en smallint .
Er min anvendelse/kombination forkert ?
--
Shortest DVD-crack:
< http://www.cs.cmu.edu/~dst/DeCSS/Gallery/hannum-efdtt-source.txt >
- Jesper Stocholm - http://stocholm.dk
| |
Lauritz Jensen (24-05-2001)
| Kommentar Fra : Lauritz Jensen |
Dato : 24-05-01 20:30 |
|
Jesper Stocholm wrote:
>
> JH <jimmy@dk2net.dk> wrote in <8cingt0o3a6t18n414nmbrsfd5772tnaea@4ax.com>:
>
> >> Er der nogen mulighed for at lave en GROUP BY på en bit-kolonne
> >Note: You cannot use GROUP BY or HAVING on ntext, text, image, or bit
> >columns unless they are in a function that returns a value having
> >another data type, such as SUBSTRING or CAST.
>
> ja ... og det var også det jeg prøvede at komme ud over i min
> SQL-statement med anvendelsen af [CAST] , hvor feltet ignorant er
> en bit-kolonne ... men forsøges konverteret/CAST'et til en smallint.
>
> Er min anvendelse/kombination forkert ?
Ja, det vil jeg tro. Prøv:
SELECT firstname, lastname, CAST(ignorant as smallint) AS ignorant
FROM table
GROUP BY firstname, lastname, CAST(ignorant as smallint)
--
Lauritz
| |
|
|