Click here to Skip to main content
15,886,798 members
Home / Discussions / Database
   

Database

 
GeneralRe: Redesign your database Pin
David Mujica15-May-09 4:07
David Mujica15-May-09 4:07 
QuestionWithout rollback Pin
Rock Star.15-May-09 1:32
Rock Star.15-May-09 1:32 
AnswerRe: Without rollback Pin
Henry Minute15-May-09 1:46
Henry Minute15-May-09 1:46 
GeneralRe: Without rollback Pin
Rock Star.15-May-09 3:15
Rock Star.15-May-09 3:15 
GeneralRe: Without rollback Pin
David Mujica15-May-09 3:31
David Mujica15-May-09 3:31 
QuestionRe: Without rollback Pin
Rock Star.15-May-09 20:54
Rock Star.15-May-09 20:54 
AnswerRe: Without rollback Pin
Mycroft Holmes15-May-09 22:10
professionalMycroft Holmes15-May-09 22:10 
QuestionNeed some help with SQL Join statements please Pin
MarkB77715-May-09 1:14
MarkB77715-May-09 1:14 
Hi,

I have 3 tables.

1. A contact table
2. A company table
3. A company to contact association table.

If a company to contact association is created, a field, 'CompanyName', in the contact table needs to contain the name of that company (in order for our mailing lists to print correctly).

I've been trying to write a query which will fill in all of the contact table 'CompanyName' values, with all of the corresponding values in the company table.

The company to contact association table is the link between the two so:

1. I need to determine which contact's have an association with a company
2. I need to get the companyID from the association table, and get the company name
3. I need to set the contact company name to the retrieved value.

Only problem is... IM STUCK!!!

This is what i've done so far.

<br />
<br />
SELECT Contacts.CompanyName<br />
FROM MarkSandpit.dbo.Contacts<br />
INNER JOIN<br />
MarkSandpit.dbo.Associations_Companies_to_Contacts<br />
ON Contacts.mxContactID = Associations_Companies_to_Contacts.mxContactID<br />
INNER JOIN mxContact.dbo.Companies<br />
ON Associations_Companies_to_Contacts.mxCompanyID = Companies.mxCompanyID<br />
<br />


This just gives me a list of all the company names in the contact table, which have associations with a company.

Could some please help me out?


Cheers,

Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
Click here to view my blog

QuestionREport server Pin
Tauseef A15-May-09 0:48
Tauseef A15-May-09 0:48 
AnswerRe: REport server Pin
Niladri_Biswas4-Jul-09 20:16
Niladri_Biswas4-Jul-09 20:16 
QuestionCreate "report query" Pin
AlexeiXX314-May-09 20:48
AlexeiXX314-May-09 20:48 
AnswerRe: Create "report query" Pin
Mycroft Holmes14-May-09 21:56
professionalMycroft Holmes14-May-09 21:56 
AnswerRe: Create "report query" [modified] Pin
Jörgen Andersson14-May-09 22:06
professionalJörgen Andersson14-May-09 22:06 
GeneralRe: Create "report query" Pin
AlexeiXX315-May-09 7:23
AlexeiXX315-May-09 7:23 
GeneralRe: Create "report query" Pin
Jörgen Andersson15-May-09 13:12
professionalJörgen Andersson15-May-09 13:12 
GeneralRe: Create "report query" Pin
AlexeiXX315-May-09 21:44
AlexeiXX315-May-09 21:44 
QuestionHow to create an exist database [modified] Pin
yueru14-May-09 16:22
yueru14-May-09 16:22 
Question[Message Deleted] Pin
munklefish14-May-09 0:41
munklefish14-May-09 0:41 
GeneralRe: STORE PROCEDURE: Problems with update statement Pin
jbracken197314-May-09 1:06
jbracken197314-May-09 1:06 
GeneralRe: STORE PROCEDURE: Problems with update statement Pin
munklefish14-May-09 2:08
munklefish14-May-09 2:08 
QuestionSQL and Novell [modified] Pin
aastudent13-May-09 20:16
aastudent13-May-09 20:16 
AnswerRe: SQL and Novell Pin
scottgp14-May-09 0:19
professionalscottgp14-May-09 0:19 
GeneralRe: SQL and Novell Pin
aastudent14-May-09 3:32
aastudent14-May-09 3:32 
GeneralRe: SQL and Novell Pin
scottgp14-May-09 4:32
professionalscottgp14-May-09 4:32 
QuestionStored Procedure problem &gt;&gt; Pin
kindman_nb13-May-09 15:29
kindman_nb13-May-09 15:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.