with cte as ( select rowid from batchinfo where datapath like '%thc%' ) select * from qvalues where rowid in cte
I get this error:
Msg 102, Level 15, State 1, Line 6 Invalid syntax next to 'cte'.
Does anyone know what I'm doing wrong?
you treat CTE as a subquery, where instead it should be used more like a table.
try it
;with cte as ( select rowid from batchinfo where datapath like '%thc%' ) select * from qvalues INNER JOIN cte on cte.rowid=qvalues.rowid
As accidentally mentioned in Al W's answer (and Tony's comment). The fact that the error is described as occurring on line 6 means that this is not the first operator in the batch. This means that you need to have a semicolon before the WITH keyword:
CTE , , .
, Transact-SQL:
SQL Server, .
.
Source: https://habr.com/ru/post/1779681/More articles:как игнорировать первое событие и переходить ко второму? - javascriptSalesforce WSDL import of simpleContent with extension - wsdlJsUnit union in JUnit - javaWhat is the best way to enforce certain values in message arguments in smalltalk? - smalltalkDoes KRL support UTF-8? - utf-8How to quickly write a Firefox extension? - firefoxSymfony: Overload helpers? - html5Best practice for std :: auto_ptr - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1779685/advice-on-languages-and-places-to-learn-them&usg=ALkJrhjQ1FXwH99EAOtGg2V1SD8tnUel3QIs there an "unput" for std :: ostream, for example, is there an "unget" for std :: istream? - c ++All Articles