Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 design question .. (2 tables or 1 )

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-09-19 : 06:52:32
Hi,

I am designing a database and am wondering which way to go on this.

I have posted the table structure below.

Each row that is posted represents a comment on an order, which will either be posted by a client or an employee. I want to run SELECT statements and get a list of all replies to an order, both clients and employees.

My question is should I have 2 seperate tables and union them ? Or have 1 table for clients, and 1 table for employees.

Employees and Clients currently have their own table and login system, they are quite different.

If I had them in 1 table, I could perhaps have a column called "postedBy" and have a 0/1 value in there to represent clientID or employeeID, then join onto the appropriate column. I would also have to have a column called PosterID

Having two tables means I have to create seperate insert statements etc for each, but not really a big deal ..


Anyone have any thoughts on this ?

Any help is much appreciated !


Thanks once again :)
Mike123


[clientID] [int] NOT NULL,
[employeeID] [int] NOT NULL,


CREATE TABLE [dbo].[tblOrder_Replies](
[replyID] [int] IDENTITY(1,1) NOT NULL,
[orderID] [int] NOT NULL,
[commentsInstructions] [varchar](8000) NOT NULL,
[commentDate] [datetime] NOT NULL,
[approvedByAdmin] [tinyint] NOT NULL,
[readByRecipient] [tinyint] NOT NULL
) ON [PRIMARY]

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-19 : 12:38:48
I would make one table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -