Welcome Guest, Not a member yet? Register   Sign In
Tricky SQL query
#15

[eluser]ehicks727[/eluser]
[quote author="uptime" date="1219782902"]Why are you using two different tables?

You could have them all under one table with a parent_id field. if parent_id = 0 it would be considered as a new thread. Otherwise set parent_id to the thread's ID. I think it would make your life a little easier. Unless you have another reason, do you?[/quote]

Because that wouldn't be a properly normalized table. Actually, it's not normalized right now because the userid is in both tables, but that's not that big of a deal.

If you threw this all in one table, you'd most likely be painting yourself into a corner. It'll bite you in the butt later when you need to perform more complex manipulations or reporting on the data. As much normalization as is reasonable is always a best practice.


Messages In This Thread
Tricky SQL query - by El Forum - 08-26-2008, 03:38 AM
Tricky SQL query - by El Forum - 08-26-2008, 04:18 AM
Tricky SQL query - by El Forum - 08-26-2008, 04:27 AM
Tricky SQL query - by El Forum - 08-26-2008, 05:08 AM
Tricky SQL query - by El Forum - 08-26-2008, 05:31 AM
Tricky SQL query - by El Forum - 08-26-2008, 07:44 AM
Tricky SQL query - by El Forum - 08-26-2008, 07:48 AM
Tricky SQL query - by El Forum - 08-26-2008, 08:06 AM
Tricky SQL query - by El Forum - 08-26-2008, 08:32 AM
Tricky SQL query - by El Forum - 08-26-2008, 08:49 AM
Tricky SQL query - by El Forum - 08-26-2008, 08:54 AM
Tricky SQL query - by El Forum - 08-26-2008, 09:09 AM
Tricky SQL query - by El Forum - 08-26-2008, 09:22 AM
Tricky SQL query - by El Forum - 08-26-2008, 09:35 AM
Tricky SQL query - by El Forum - 08-26-2008, 10:05 AM
Tricky SQL query - by El Forum - 08-27-2008, 02:03 AM
Tricky SQL query - by El Forum - 08-27-2008, 08:25 AM
Tricky SQL query - by El Forum - 08-27-2008, 08:28 AM
Tricky SQL query - by El Forum - 08-27-2008, 08:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB