如何为表中的一个属性添加行

时间:2016-07-14 06:33:06

标签: php mysql

关于mysql的

如何在表中只添加一个属性?或者如何在数据显示时断行? 是否可以在不添加新表的情况下执行此操作?

表:

case title people vs john
docket number 11235
nature appeal
action taken july 11 received case folder. july 12 create pleading. july 14 file pleading ...
status

如何显示如下表:

`case title people vs john
docket number 11235
nature appeal
action taken july 11 received case folder
         july 12 create pleading
         july 14 file pleading
status awaiting further notice

请注意,所采取的操作有很多次迭代,这就是为什么我希望在显示时添加新行或断行

供参考: sample of what is currently happening

1 个答案:

答案 0 :(得分:0)

如果action taken是平坦的条纹,您可以使用更新

  update my_table 
  set `action taken` = concat( `action taken` , ' ' , 'july 14 file pleading')
  where `case title` = 'people vs john'
  and `docket number` =  11235; 

但如果您需要规范化解决方案,则应创建一个与主表相关的操作表

my_master_table

id 
case title
docket number
nature
status

my_action_taken_table     ID     master_id     ACTION_TAKEN

和用于添加新动作的用途插入和加入以选择