jean-paul
jnatola at hotmail.com
Sat Jan 31 10:54:58 CST 2009
the contacts table has 24 fields id first_name last_name etc.., I want every single record and field from that table.the contacts_org_types table has three fields id organization_type and internal, I want only the organization_type field from that table, so , I *believe* that i should see 25 fields in my result 24 from table 1 and 1 from table 2- thanks Jean-Paul Natola > From: markamatte at hotmail.com> To: dba-sqlserver at databaseadvisors.com> Date: Sat, 31 Jan 2009 12:49:06 +0000> Subject: Re: [dba-SQLServer] Newbie needs help with select statement> > > I hate to make assumptions...but the subject says 'newbie'...and Francisco suggested the fields to join on...not Jean Paul.> > Jean Paul, what fields from each table are you trying to join on(the actual field names)? > > If the example below was used 'as is' and there is an 'ID' field in each table but its not the relationship between these two tables...won't give the results.> > As long as I am 'assuming'...I think the scenario might be a translation table...and the first attemp produced a cartesian join(no joins) and listed each contact having every kind of cust_org_types...so the confusion might be what fields to join on.> > Francisco's Example modified:> > SELECT * FROM contacts AS ctcs> INNER JOIN contacts_organization_types AS cot ON ctcs.cust_org_types = cot.id> > I'm guessing there is a cust_org_types field in the contacts table...and there is a value that needs to be translated?> > If I am off target...please let me know.> > Thanks,> >> _________________________________________________________________ Hotmail® goes where you go. On a PC, on the Web, on your phone. http://www.windowslive-hotmail.com/learnmore/versatility.aspx#mobile?ocid=TXT_TAGHM_WL_HM_versatility_121208