dswsl2016 2012-09-29 19:52
浏览 10
已采纳

在一个id中保存一个变量的1个以上数据

I crawled a web, for example I crawled to get the authors ($author) and the link of authors. For one id, sometime, there are 2 authors, and when I save them in database, they will be separated in different id,

for example : I get $author and $link = string(14) "Aaron M. Cohen" string(73) "http://example.com/Author/4279758" string(16) "William R. Hersh" string(68) "http://example.com/Author/299122"

===========================================================
|id|web|      author    |            author_link          |
===========================================================
|1 | A |Aaron M. Cohen  |http://example.com/Author/4279758|
|2 | A |William R. Hersh|http://example.com/Author/299122 |
===========================================================

Is it possible to save them in one same id? How? thank you in advance :) fyi, I wanna save them in one id, because of the next process is I want to inner join the table with other table that have same web. If there are two id in same web, they will be printed twice.

  • 写回答

1条回答 默认 最新

  • doutang7414 2012-09-29 19:56
    关注

    No. Create another table that actually contains the author and a fkey to the id in order to keep the database in first normal form.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?