mysql - select statement in case statement sql -


How do I execute a SQL statement in the statement statement?

I am trying to execute the following query and get the error:

 , select the case when 'trans_type' & lt; & Gt; Select 'stock' then lname else (select item_name from trans_i, where the range of id = a.id 0,1) as 'transaction' in the form of 'transaction' as the end   

Database MySQL

Error:

  Error code: 1064 You have an error in your SQL syntax; Please check your manual manual related to the SQL Server version for correct syntax to use the select item_name from the transa limit 0,1   

ps: I only for the demo purpose table I am using the transaction as the name, this is not a 'transaction' in my real database.

I think this should be the correct statement. Choose

 , (when trans_type  'stock' then select item_name from a.lname else (trans_i ti where ti.id = a.id boundaries 0, 1) As 'A'     from the 'Lname' transaction as the end)

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -