sorry for possibly noobish question - I'm not a pro in SQL.

So i have to make a so called "creation groups" - user will create multiple items at one time, and system must remember, which items were created together. So it will should look in db like this:

Id|Name             | GroupId
1 |Teddy Bear       | 1
2 |Toy Car|         | 1
3 |Toy Soldier      | 2
4 |Bottle of whiskey| 3 

So, when user will click Teddy Bear or Toy Car, he will see them both in new window, when on Toy Solier. he will see only Toy Soldier in edit window etc.

Thee best way ofc is to create new table "Groups" where id will be as identity value. But The main problem - in my case this table will consist only of .... id column and that's all. No names etc, just id. And I don't want to create new table only to store identity. Another approach is to get max value each time you want to insert new data and add to new records with this max+1 value into GroupId column, but this will be kinda slow.

I'm using CSLA framework as ORM (it kinds sux comparing to EF and nhibernate, but does it's job pretty well)

Could anyone advice best approach on this situation?

Thank You in advance, Denis

有帮助吗?

解决方案

Is there a reason that the grouping identity has to be an integer? Why not use a GUID?

If you want an int, then I think your "groups" table is the way to go. IMO.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top