[dba-SQLServer] Newbie needs help with select statement

jean-paul jnatola at hotmail.com
Sat Jan 31 17:10:38 CST 2009


the contacts table does NOT have organization type- it has  id, first, last, add , cty, st, zip, tel, fax, dte_created,  email, etc..  but nothing regarding organization type-   I will try you code and let you know- if been on this for the last 30 hours  racking my brain- on a good note i  read and learned alot  since yesterday btw,  I'm using MySQL  and doing this via phpMyAdmin- if it makes any difference           Jean-Paul Natola > From: ab-mi at post3.tele.dk> To: dba-sqlserver at databaseadvisors.com> Date: Sat, 31 Jan 2009 23:58:09 +0100> Subject: Re: [dba-SQLServer] Newbie needs help with select statement> > Francisco may be is right about a third junction table between your contacts> and contacts_organization_types tables. But perhaps it's more simple that> that.> > You told us the tree fieldnames of your contacts_organization_types table> (id, organization_type, and internal_only) but you didn't tell us all names> of the 24 fields in your contacts table.> > My question is: do your contacts table have a field named something like> "organization_type_id"?> > In that case you might have a simple one-to-many relationship and your query> would be something like:> > SELECT ctcs.*, cot.organization_type FROM contacts AS ctcs> INNER JOIN contacts_organization_types AS cot ON ctcs.organization_type_id> = cot.id
_________________________________________________________________
Windows Live™ Hotmail®…more than just e-mail. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_howitworks_012009


More information about the dba-SQLServer mailing list