Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

sql one query

using sql server 2005

select productid from orderitems left join orders on orderitems.orderid = orders.orderid where orderitems.orderid = 'x'
select internalsku from products where productid= query



I want to put this into one query
0
rgb192
Asked:
rgb192
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
select internalsku from products where productid IN (select productid from orderitems left join orders on orderitems.orderid = orders.orderid where orderitems.orderid = 'x' )
0
 
fhillyer1Commented:
Select Internalsku from Products where productid in (Select productid from orderitems left join orders on orderitems.orderid = orders.orderid where orderitems.orderid = 'x')

have it in one line
0
 
rgb192Author Commented:
works
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now