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.
| Author |
Topic |
|
Delinda
Constraint Violating Yak Guru
315 Posts |
Posted - 2010-02-03 : 16:05:38
|
| My table as followtCounterTrnxID | CoutCd | Desc-----------------------------1 | IPH | IPOH2 | HPT | HPUTRA3 | JB | JBHARU4 | KNTN | KUANTAN*TrnxID is a identity field and primary key*CoutCd is a uniquetCounterRoutTrnxID | RID | CoutCd | Sequence----------------------------------------------------1 | _r00000001 | IPH | 12 | _r00000001 | HPT | 23 | _r00000001 | JB | 34 | _r00000002 | IPH | 15 | _r00000002 | KNTN | 2*TrnxID is a identity field and primary key*RID,CoutCd is a unique*RID,Sequence is a unique*Sequence is a ranking in RID. Let's say, _r00000001 = IPH - HPT - JB. _r00000002 = IPH - KNTNBased on tCounterRout, I plan to create Rout value as follow1. _r00000001, IPH to HPT2. _r00000001, IPH to JB3. _r00000001, HPT to JB4. _r00000002, IPH to KNTNThe rule as follow,* _r00000001, IPH to HPT is valid because of IPH (1) and HPT (2), if HPT (2) to IPH (1), this is invalid. * _r00000001, IPH to JB is valid because of IPH (1) and JB (3), if JB (3) to IPH (1), this is invalid.* _r00000001, HPT (2) to JB (3) is valid. If JB to HPT, this is invalid* _r00000002, IPH to JB is invalid because in _r00000002, there's no JBHow to design table, i can save RID, From, To, PriceThe value as follows1. In _r00000001, From IPH to HPT the Adult Price is 14.00, Child Price is 7.002. In _r00000001, From IPH to JB the Adult Price is 25.00, Child Price is 11.003. In _r00000001, From HPT to JB, the Adult Price is 13.00, Child Price is 8.00Need guidance |
|
|
mymatrix
Starting Member
24 Posts |
Posted - 2010-02-04 : 01:07:36
|
| As per my understanding, you need table design for last part (Pricing of tickets)Table Design below:Rates Table------------RIDFrom (TrnxID of tCounterRout table)(F.Key datatype - same as of P.Key in tCounterRout table)RIDTo (TrnxID of tCounterRout table)(F.Key datatype - same as of P.Key in tCounterRout table)PriceAdult ChildPriceNote : No need for PrimaryKey in this table if no further details needs to be stored in child tables.Secondly, you can store tCounter.TrnxID as F.Key in table tCounterRout in place of CoutCd column.**************************************Even my blood group says be -ve to all the negatives. |
 |
|
|
Delinda
Constraint Violating Yak Guru
315 Posts |
Posted - 2010-02-04 : 03:15:34
|
| Your guidance is my inspiration |
 |
|
|
|
|
|
|
|