Click here to Skip to main content
15,911,715 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
drop table #start_task
 select order_id, merchant_id, start_task
 FROM [oms_operation].[dbo].[user_productivity_task]
 where year_month between '201407' AND '201409' and order_id = (select * from #Order_id)


Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Posted
Updated 18-Nov-14 2:17am
v3
Comments
PIEBALDconsult 17-Nov-14 18:13pm    
change -- (select * from #Order_id)

And don't store dates as strings.
King Fisher 18-Nov-14 8:19am    
Update your Question with an error .because if anybody google it for the same thread they could identify easily :)

Depends on the error but you have ..
SQL
and  order_id = (Select * from #Order_id)


As this will return a list it should be

..
SQL
and order_id in (select order_id from #order_id)


This assumes the order_id is the name of the field in #order_id table you are filtering on..
 
Share this answer
 
v2
try this..

SQL
 select order_id, merchant_id, start_task
 FROM [oms_operation].[dbo].[user_productivity_task]
 where year_month between '201407' AND '201409' and order_id =(select order_id  from #Order_id where order_id=@order_id)

###For single order_id value
or

 select order_id, merchant_id, start_task
 FROM [oms_operation].[dbo].[user_productivity_task]
 where year_month between '201407' AND '201409' and order_id in (select order_id  from #Order_id)


###For multiple order_id value
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900