SELECT DISTINCT problems

From: SCAHILL KEVIN <9726209(at)student(dot)ul(dot)ie>
To: "'pgsql-sql(at)postgreSQL(dot)org'" <pgsql-sql(at)postgreSQL(dot)org>
Subject: SELECT DISTINCT problems
Date: 2001-02-27 18:05:58
Message-ID: 992C0C12C388D411B264009027AA341804258E7F@gabriel.ul.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there,
I'm having a lot of trouble with one sql statement and I wonder can you
help.

I My problem is the following...there are two field name in the the table
named LecturerName and Projectcode. Each ProjectCode vulue is unique within
the table but there can be many entries in the table with the same
LecturerName.

I would like to pull each distinct value of LecturerName with any one
corresponding ProjectCode value, it does not matter what the ProjectCode
value is, but all attemps at this have failed so far.

I have tried this but it does not work:

Set rsLecturers = Server.CreateObject("ADODB.Recordset")
sqlLect = "Select LecturerName, MIN(ProjectCode) from tblSuggestions WHERE
LecturerName IN ( SELECT DISTINCT LecturerName FROM tblSuggestions)"
rsLecturers.Open sqlLect, Conn, 3, 3

I get this error when I try to run this:
[Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that
does not include the specified expression 'LecturerName' as part of an
aggregate function.

I am trying to put the results of this query into a recordset and I am using
an accessdatabase
Thanks in advance,
Kevin.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-27 19:01:45 Re: Urgent help
Previous Message Jie Liang 2001-02-27 18:01:50 Re: underscore problem