[thelist] SQL selecting distinct from multiple index tables

David Siedband david at calteg.org
Fri Jan 30 23:59:53 CST 2004


awesome, thanks!

That worked.
--
Dave





On Jan 30, 2004, at 9:55 PM, Raditha Dissanayake wrote:

> Hi
> can't say for certain without knowing more about your data but i would  
> try something like
> where ( OrgDocs.OrgID = Organizations.OID ) OR  (OrgProjects.OrgID =  
> Organizations.OID)
>
> and add the other columns to your select.
>
> all the best
>
> David Siedband wrote:
>
>> I have two index tables the associate Organizations with documents  
>> and projects.  I'm trying to write a query that returns all the  
>> organizations that are associated with either a project or document.
>>
>> To select unique organizations that are either associated with a  
>> Document or a Project, I'm using SQL that looks like this.
>>
>> select distinct Organizations.OID , Organizations.Name ,  
>> Organizations.Acronym
>> from OrgDocs , Organizations
>> where OrgDocs.OrgID = Organizations.OID
>>
>> select distinct Organizations.OID , Organizations.Name ,  
>> Organizations.Acronym
>> from OrgProjects , Organizations
>> where OrgProjects.OrgID = Organizations.OID
>>
>> Any suggestions on how to combine this into a single query?
>>
>> thx,
>>
>> --  
>> David
>>
>>
>>
>>
>>
>
>
> --  
> Raditha Dissanayake.
> ----------------------------------------------------------------------- 
> -
> http://www.radinks.com/sftp/         |  
> http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
>
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester and  
> archives of thelist go to: http://lists.evolt.org Workers of the Web,  
> evolt !



More information about the thelist mailing list