Home > database >  SQL judgment
SQL judgment

Time:10-08

According to field sSaleOrderCode judgment, if pin sample S beginning G show spare embryos, in the beginning, the rest of the goods, but why the error


Message 512, level 16, state 1, line 44
Subquery returns the value of more than one, when the query to follow in=,!=, & lt; , & lt;=, & gt; , & gt;=, or the subquery is used as the expression, the situation is not allowed,

CodePudding user response:

CASE the WHEN SSALEORDERCODE LIKE '% S' THEN 'pin sample' S SSALEORDERCODE LIKE 'G %' THEN 'spare embryos' ELSE' big goods' END AS 'order type'

CodePudding user response:

No, like grammar mistakes

CodePudding user response:

Error not have told you, you of two sentences like son query returns the results of more than one line, you judge the beginning letter of what to do with the table subquery, resources are not more so, had left or substr

CodePudding user response:

refer to the second floor weixin_43292238 response:
wrong, like grammar


Stick your complete code

CodePudding user response:

This is, I can is to test the SQL statement, like judges as the when condition?

CodePudding user response:

reference 5 floor weixin_43292238 reply:
this is, I can is to test the SQL statement, like judges as the when condition?


LIKE is to be able to when the when the judgment of the conditions, your mistake is that value judgment conditions is a child of the query result set, and the result set record more than one result, one-to-many how to determine,

CodePudding user response:

, solved the case after more than a field name, thank you

CodePudding user response:

Is not the case after more than a field name, 6th floor positive solutions
  • Related