sql server 2008 - how to select one image of a object stored in another table -
the question may easy product table in sql
id, name, . . . productimage id,productid,image select image in select query of product need first/last image of product1,first/last image of product2 etc
that is
select product.id,product.name,(select top(1)image productimage productimage.productid=product.id)as image product this query gives me first image of first product in product list
thank you
try this,maybe useful:
select product.id,product.name, (select top (1) image productimage productimage.productid=product.id order productimage.id asc)as firstimage , (select top (1) image productimage productimage.productid=product.id order productimage.id desc) lastimage product
Comments
Post a Comment