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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Query to combine two 'many:one' tables

Re: Query to combine two 'many:one' tables

From: Jens Süßmeyer <jsuessmeyer_at_(Remove_ME>
Date: Mon, 1 Sep 2003 08:05:00 +0200
Message-ID: <eqRgZ4EcDHA.2632@TK2MSFTNGP12.phx.gbl>


Hallo Jon !

Here is the answer to your question:

      SELECT  CL.ClientID,CT.ClientType,dbo.fn_Myfunc(ClientID) as Cases
        FROM
        (
         SELECT DISTINCT ClientID,CLientTypeID FROM  tblClients
        )AS CL

 INNER JOIN tblClientTypes CT
 ON
 CT.CLientTypeID=CL.CLientTypeID
ClientID    ClientType                                         Cases
----------- -------------------------------------------------- -------------
-----------------
1           Person                                             1,2,3
2           Person                                             4,5
3           Company                                            6
4           Company                                            7,8,9,10,11
5           Company                                            NULL
6           Person                                             12

(6 row(s) affected)

HTH, Jens Süßmeyer. Received on Mon Sep 01 2003 - 01:05:00 CDT

Original text of this message

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