0

I have the following database structure:

categories:

    cat_id |   name
    -------+--------
         1 | test 1
         2 | test 2

date:
    id |   text | cat_id
    ---+--------+--------
     1 | google |      1
     2 |     fb |      2
     3 |  yahoo |    1,2

I want to display "yahoo" in both categories. I know it's not good to store two values in the same cell. My last idea is to insert two rows with same text but different cat_id.

Is there any other way to do this?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64

1 Answers1

0

You can have it like this:

categories:

cat_id |   name
-------+--------
     1 | test 1
     2 | test 2

date:

id |   text | cat_id
---+--------+--------
 1 | google |      1
 2 |     fb |      2
 3 |  yahoo |      1
 4 |  yahoo |      2
Thanasis1101
  • 1,614
  • 4
  • 17
  • 28