Last post Oct 25, 2015 11:22 PM by Krunal Parekh
Oct 24, 2015 03:04 PM|prontonet|LINK
I have a database table called "BookingsCount" as below
CountId - int p/k
ArtistId - guid
Total - int
In this table I want to store the number of bookings the artist receives.
So when a booking is complete I have an INSERT statement
that updates table with date, artistid parameter and Total
I need to show the INT of bookings by that artist on aspx page.
Do I add a new row for each booking and then Count rows by that
artist or do icrement total column each time ??
Oct 24, 2015 04:14 PM|mgebhard|LINK
Just to do a COUNT by artist. Calculated fields are not good DB designs and lead to over-complicated bug ridden code.
Oct 25, 2015 11:22 PM|Krunal Parekh|LINK
You can do the insert by artistid and date.
DECLARE @BookingCount TABLE
CountId int IDENTITY(1,1) PRIMARY KEY,
this way you get total for each artists for each date.