Re: [SQLDownUnder] Table Design


    [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
    • From: noonie
    • Subject: Re: [SQLDownUnder] Table Design
    • Date: Sun, 03 Sep 2006 15:53:04 -0700

    Jake,
    
    I'm a bit of a "visual guy" so a sample of what you expect in the
    result set would help :-)
    
    Also - I'm not sure what you mean by "Individuals". Are these Contacts
    not associated with a Company (or business entity)?
    
    --
    Regards,
    Neale NOON
    
    On 03/09/06, Jake Ginnivan <ginnivan@xxxxxxxxxxxx> wrote:
    
    That looks good.
    
    With that would a query something like this be the best way to do a search
    query on this data be something like this?
    
    SELECT CompanyId, CompanyName FROM Companies
       WHERE CONTAINS (CompanyName, 'name')
    UNION
    SELECT Contacts.CompanyId, CompanyName FROM Contacts
       OUTER JOIN Companies ON Contacts.CompanyId = Companies.CompanyId
       WHERE CONTAINS (FirstName|LastName, 'name')
    ORDER BY CompanyName
    
    So that will list companies that match the search or companies that have
    contacts that match the search?
    
    To extend this to individuals, people that don't belong to a company at all
    I would add a individuals table
    
    IndividualId, FirstName, LastName, Email, ...
    
    I would need to specify in the results a column which specified if the
    result was a company or a individual, so the software would know what table
    to go looking in to get the info. how would I go about doing this?
    
    In the crm I don't want to have separate places to search for individuals or
    companies, I would like them to be part of the same results
    
    Many Thanks,
    Jake
    
    
    
    to unsubscribe to this list, please send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com - List managed by http://www.readify.net
    
    
    
    



    (Click here for more information on the sqldownunder mailling list)