如何将多行合并为一个

问题描述 投票:0回答:0

关于我的结果,我想像下面那样

和我的数据库图:

Table category {
  category_id integer [primary key]
  category_title varchar
  category_icon varchar 
}

Table style {
  style_id integer [primary key]
  sytle_title varchar
  style_icon varchar
}

Table season {
  season_id integer [primary key]
  season_title varchar
  season_icon varchar
}

Table attributes {
  attribute_id integer [primary key]
  attribute_title varchar
  attribute_icon varchar
}

Table item {
  item_id integer [primary key]
  item_title varchar
  item_icon varchar
  style_id integer
  season_id integer
  category_id integer
}

Table item_attribute {
  item_id integer
  attribute_id integer
  value bool
}



Ref: style.style_id < item.style_id // many-to-one
Ref: category.category_id < item.category_id
Ref: season.season_id < item.season_id

Ref: item.item_id < item_attribute.item_id
Ref: attributes.attribute_id < item_attribute.attribute_id

我想用一些属性来存储我的项目。我试过实现 EAV 数据库模型我怎么不能正确地为空属性

sql sqlite entity-attribute-value sql-query-store
© www.soinside.com 2019 - 2024. All rights reserved.