下面的代码选择3级随机的物品(照片)的价格,并将其传递到我的网站作为一个字符串..从另一个SQL表中选择的数据添加到字符串文本
SELECT TOP 3
thisweeksDate
,'<br/><a href="catalog/images/'
+ [filename] +
'" class="nyroModal" rel="gal" title="'
+ [price] +
'" ><img src="catalog/images/thumbnails/'
+ [filename] +
+ '" /></a>'
+ [price]
as strText
,fileID
FROM [OCBUser].[tblItems]
WHERE thisweeksDate = @thisweeksDate and price <> ''
ORDER BY NEWID()
上述作品完美,但我不知道够不够SQL尚未做到以下几点..
我需要它也选择
friendlyOrderID from [OCBUser].[tblOrders]
where [OCBUser].[tblItems].accountID = [OCBUser].[tblOrders].accountID
,并与超链接p添加到strText的refix所以它可以点击。因此,这将需要inclide像...
<a href="www.mysite.com/' + [friendlyorderID] + '"
任何想法?
很多谢谢。
你试图使用JOIN? – OHHO