【问题标题】:how to get list data from foreign key to another list of data如何从外键获取列表数据到另一个数据列表
【发布时间】:2021-08-17 10:39:32
【问题描述】:

Image

我们有 2 个表,第一个表名为 attributes_products,其中 attritubes_id 第二个表的外键是属性,因此我们可以使用第一个表找到第二个表的列表

【问题讨论】:

    标签: php database laravel arraylist foreign-keys


    【解决方案1】:

    您可以尝试使用右连接表格。

     SELECT attributes_products.id,attributes.attributes_name,attributes.attributes_type,attributes.attributes_required,attributes.attributes_status
    FROM attributes_products
    RIGHT JOIN attributes
    ON attributes_products.id = attributes.id;
    

    更多信息-https://www.w3schools.com/mysql/mysql_join_right.asp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-22
      • 1970-01-01
      • 2018-12-08
      • 2014-03-23
      • 1970-01-01
      • 2010-10-04
      • 1970-01-01
      • 2013-12-13
      相关资源
      最近更新 更多