Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Basic SQL problem

Basic SQL problem

From: Steve <S.Tucker_at_tesco.net>
Date: Thu, 30 Dec 1999 20:13:06 -0000
Message-ID: <84gego$q4u$1@epos.tesco.net>


I have written the following statements to try and select the latest CAT_DESC grouped by CLIENT ID, but it returns duplicate rows for each CLIENT_ID. Can someone please have a look and tell me where I am going wrong.

Cheers for any help.

SELECT
  OPS$CRMSLIVE.O_PERSONS.PER_ID,
  initcap(OPS$CRMSLIVE.O_PERSONS.PER_SURNAME || ', ' || OPS$CRMSLIVE.O_PERSONS.PER_FIRST_NAMES),   max(Client.CLA_DATE_NOTIFIED),
  nvl(initcap(Client_cat_des.CAT_DESC),'Missing') FROM

  OPS$CRMSLIVE.O_PERSONS,
  OPS$CRMSLIVE.O_CLASSIFICATIONS  Client,
  OPS$CRMSLIVE.O_CATEGORIES  Client_cat_des
WHERE OPS$CRMSLIVE.O_PERSONS.PER_ID=Client.CLA_SUBJECT_ID(+) AND Client.CLA_SUBJECT_IND(+)='P' AND Client.CLA_END_DATE(+) IS NULL )   AND ( Client.CLA_CAT_ID=Client_cat_des.CAT_ID(+) AND Client_cat_des.CAT_TOP_CAT_ID(+) = 'CLIENT' )   AND ( OPS$CRMSLIVE.O_PERSONS.PER_ID=Client.CLA_SUBJECT_ID(+) AND Client.CLA_SUBJECT_IND(+)='P' AND Client.CLA_END_DATE(+) IS NULL )   AND ( Client.CLA_TOP_CAT_ID(+) = 'CLIENT' )   AND (
  nvl(initcap(Client_cat_des.CAT_DESC),'Missing') IS NOT NULL   AND (Client.CLA_TOP_CAT_ID(+) = 'CLIENT')   )
GROUP BY
  OPS$CRMSLIVE.O_PERSONS.PER_ID,
  initcap(OPS$CRMSLIVE.O_PERSONS.PER_SURNAME || ', ' || OPS$CRMSLIVE.O_PERSONS.PER_FIRST_NAMES),   nvl(initcap(Client_cat_des.CAT_DESC),'Missing') Received on Thu Dec 30 1999 - 14:13:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US