|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Simple selectWhat is this statement missing ?
SELECT id FROM Cases WHERE Cases.tempcaselogid = CaseComments.tempcaselogid I get this error: Server: Msg 107, Level 16, State 3, Line 1 The column prefix 'CaseComments' does not match with a table name or alias name used in the query. I need to use "WHERE" and not a "JOIN" Aleks What do you mean by you need to use WHERE instead of JOIN?
You need to use a join in order to include the CaseComments table, which has not been specified as a source table for the query. Aleks wrote: Show quote > What is this statement missing ? > > SELECT id FROM Cases WHERE Cases.tempcaselogid = CaseComments.tempcaselogid > > I get this error: > > Server: Msg 107, Level 16, State 3, Line 1 > The column prefix 'CaseComments' does not match with a table name or alias > name used in the query. > > I need to use "WHERE" and not a "JOIN" > > Aleks > > Hi Aleks,
If you're new to newsgroups I forgive you. Please don't multi-post. You posted the same question in sqlserver.newusers Some people may waste their time answering when it's already been answered in the other newsgroup when their time would have been better spent on another question. You MAY crossgroup to a very limited number (2 max). That way, we will see answers from both newgroups. In this case, one of the 2 groups would have been sufficient. Show quote "Aleks" <arkark2***@hotmail.com> wrote in message news:e5FkOaq9FHA.1188@TK2MSFTNGP12.phx.gbl... > What is this statement missing ? > > SELECT id FROM Cases WHERE Cases.tempcaselogid = > CaseComments.tempcaselogid > > I get this error: > > Server: Msg 107, Level 16, State 3, Line 1 > The column prefix 'CaseComments' does not match with a table name or alias > name used in the query. > > I need to use "WHERE" and not a "JOIN" > > Aleks > Add CaseComments to FROM clause:
SELECT id FROM Cases, CaseComments WHERE Cases.tempcaselogid = CaseComments.tempcaselogid Aleks wrote: Show quote > What is this statement missing ? > > SELECT id FROM Cases WHERE Cases.tempcaselogid = CaseComments.tempcaselogid > > I get this error: > > Server: Msg 107, Level 16, State 3, Line 1 > The column prefix 'CaseComments' does not match with a table name or alias > name used in the query. > > I need to use "WHERE" and not a "JOIN" > > Aleks > > |
|||||||||||||||||||||||