Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-18 : 09:16:49
|
| Marcus writes "I have an issue with an insert statementINSERT INTO table1 (ContactId,OrganizationId,Problem)SELECT Contact.ContactId, Organization.OrganizationIdFROM Contact INNER JOIN (Organization INNER JOIN Issue ON Organization.OrganizationId = Issue.OrganizationId) ON (Organization.OrganizationId = Contact.OrganizationId) AND Contact.ContactId = Issue.CustomerIdWHERE Contact.Email = "JOHN" AND Organization.OrgCode = "ZZZ";I have an additional value of problem which I would like to insert (Problem) that is not taken care of in the SELECT statement. How do I get this into the list?" |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2001-12-18 : 09:36:51
|
| You can have constants in your select statementINSERT INTO table1 (ContactId,OrganizationId,Problem)SELECT Contact.ContactId, Organization.OrganizationId,'Problem'FROM Contact INNER JOIN (Organization INNER JOIN Issue ON Organization.OrganizationId = Issue.OrganizationId) ON (Organization.OrganizationId = Contact.OrganizationId) AND Contact.ContactId = Issue.CustomerIdWHERE Contact.Email = 'JOHN' AND Organization.OrgCode = 'ZZZ'Btw, you should use ' rather than " as a string delimiter. |
 |
|
|
|
|
|