Forum Moderators: coopster & phranque

Message Too Old, No Replies

Help Linking 2 SQL Tables

Fatal flaw in my planning!

         

Nick_W

10:13 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

Just spotted serious flaw in my design. This is simplified to demonstrate:

For a blog type thingy:

Topics
id ¦ title ¦ description

Text
id ¦ parent ¦ timestamp ¦ text

Works great untill you realize that the starting post for any topic has potentially multiple values.

EX: if I try to find the text for topic 34 I can just find the matching entry for parent in the text table. But if there are replies to the topic it will return more than one row.

I could use the timestamp of course but what if I splice or combine posts for some reason? - Not good enough is it?

So, what's the most efficient way to do this properly? - I just can't figure it...

Many thanks..

Nick

Nick_W

10:52 am on Mar 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...or

I could add another coloum to Text like this:

id ¦ is_start ¦ parent ¦ text

And have is_start be a boolean (TINYINT(1)) - That way I'd just need to find the matching parent colum where is_start = 1

Does that make sense?

THanks

Nick