Board index » delphi » Use of DISTINCT

Use of DISTINCT

Hi all
I have a query which requires the use of DISTINCT, but my query includes an
Image field so when I open the query I get the message 'Text/Image datatype
cannot be selected as DISTINCT.'.
Is there any way I can exclude this field from the DISTINCT, but keep it in
the query?

Ta much

John Hair
Designer Systems Ltd

 

Re:Use of DISTINCT


Try group by:

    select a, b, c, d
    from my_table
    where ...
    group by a;

Effectively, all distinct combinations of a, b, c, d will be retreived. That
is, if group by supports Text/Image datatype...

________________________________________
Arjan van Bentem
Hilversum, the Netherlands
 avbentem at the server of cable.a2000.nl

Re:Use of DISTINCT


Oops, of course the last line should read

    group by a, b, c, d;

Arjan.

Re:Use of DISTINCT


Arjan,

I don't know of any db that supports blobs in a distinct or group by
clause.
Do you know one?

--
Joachim Meyer (J...@basys-bremen.de)
BASYS EDV-Systeme GmbH

Arjan van Bentem <a.v.ben...@DONT-YOU-DARE-cable.a2000.nl> schrieb im
Beitrag <69o6ij$e...@forums.borland.com>...

Re:Use of DISTINCT


Quote
>I don't know of any db that supports blobs in a distinct or group by
>clause.
>Do you know one?

Well, I know Oracle 7 does not:

From the Oracle7 Server Application Developer's Guide, page 3-7:
Restrictions on use of LONG and LONG RAW data:

- only 1 LONG column per table
- LONG columns cannot be indexed
- LONG columns cannot appear in integrity contstraints
- LONG columns cannot be used in WHERE, GROUP BY, ORDER BY, or CONNECT BY
  clauses, or with the DISTINCT oeprator in SELECT statements.
- LONG columns cannot be referenced by SQL functions (such as SUBSTR or
INSTR)
- LONG columns cannot be used in the SELECT list of a subquery or queries
  combined by set operators (UNION, UNION ALL, INTERSECT, or MINUS).
- LONG columns cannot be used in SQL expressions
- LONG columns cannot be referenced when creating a table with a query
(CREATE
  TABLE...AS SELECT...) or when inserting into a table(or view) with a
  query(INSERT INTO...SELECT...)
- a variable or argument of a PL/SQL program unit cannot be declared using a
  LONG datatype
- LONG columns cannot be indexed

Arjan.

Other Threads