开发者

distinct values from one to many table relation?

开发者 https://www.devze.com 2023-02-20 03:35 出处:网络
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 w

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

精彩评论

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