开发者

distinct values from one to many table relation?

I have a table 'tbl_user' with columns user_id, uer_name,user_address. And product table 'tbl_product' with columns product_id, product_price, product_date, user_id(This one from tbl_user). So I want to select distinct values from this who开发者_JS百科le table relation based on product date.


As far as I understand, this should work:

SELECT DISTINCT d.*, u.*
FROM tbl_product p
  INNER JOIN tbl_user u ON p.user_id = u.user_id
WHERE product_date = @paramDate

Or you may need to clarify your question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜