New topic: 

Multiple Person linked to Project, how to do SQL select?

<http://forums.realsoftware.com/viewtopic.php?t=38368>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        helgetjelta          Post subject: Multiple Person linked to 
Project, how to do SQL select?Posted: Mon Mar 28, 2011 4:03 pm                  
       
Joined: Tue Feb 20, 2007 2:05 pm
Posts: 51                Hi, I have a Project table, and want to use 4 
"object-pointers" (valentina) to store values for 4 persons (Edit, producer, 
director, sound). All 4 comes from the same persons table...

I want to do something like this:
SELECT Project, Info, Name as Editor, Name as Producer, Name as Director, Name 
as Sound
>From Project
JOIN Person ON Link_Project_Person //  M:M
Where Project like '1201'

How to setup a Link like this, and how do it difference between the 4 
persons-link, is it according to placement in sql ?   
                             Top                DaveS          Post subject: 
Re: Multiple Person linked to Project, how to do SQL select?Posted: Mon Mar 28, 
2011 8:26 pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 2882
Location: San Diego, CA                Code:SELECT a.project,a.name as 
editor,b.name as producer,c.name as director,d.name as sound
  FROM (select project,name FROM project x,person where  
x.link_project_person=y.link_project_person and y.link_project_person='EDITOR') 
a,
      (select project,name FROM project x,person where  
x.link_project_person=y.link_project_person and 
y.link_project_person='PRODUCER') b,
    (select project,name FROM project x,person where  
x.link_project_person=y.link_project_person and 
y.link_project_person='DIRECTOR') c,
     (select project,name FROM project x,person where  
x.link_project_person=y.link_project_person and y.link_project_person='SOUND') d
where a.project=b.project and b.project=c.project and c.project=d.project and 
d.project='1201'


Had to make some assumptions about your tables....... but something like this 
should work (off the top of my head... not tested)...
and it ASSUMES that there are no conflicts in the tables.....      
_________________
Dave Sisemore
MacPro, OSX 10.6.4 RB2009r5.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to