Firstly, as a disclaimer, I'm learning a little about SQL/LINQ indirectly through C#. I'm very green in both really. I've quickly grown tired of using sample databases full of data and doing queries set in the most simple of situations. The information is presented this way because the focus is on C# and visual programming and not the hairies of SQL or even LINQ for that matter.
Even so, I decided to convert a simple application I wrote using text (CSV) files for storage. The application keeps track of three possible payables where 0 - 3 records will exist for a given date. I was able to create the database and separate tables for each contract and build an application that inserts the existing records into the database using LINQ to SQL classes.
Now I have another application that is used to add entries via a contract calculator or directly through a BindingSourceNavigator and DataGridView. Each table has in common four columns - Date, GrossPay, TaxAmount, and NetPay, Date being the primary key. I'd like to view the records by date where I have TotalGross, TotalTax, TotalNet, and a column for the GrossPay each contract table for that date.
What would correct approach to this - a view, LINQ query, separate table, or other? It seems a table would be the "easiest", at least in terms of my ability, but seems like an unnecessary copying of records. I tried to "link" the tables but no other column is guaranteed to be unique or primary.
Any suggestions would be great.
Clarification:
Three tables have the format:
| Date | GrossPay | TaxAmount | NetPay | ...each have others not in common... |
** Each table has specific data used to calculate the common columns based on contract type
I would like to view all records "grouped" by date such that each are represented like:
| Date | TotalGross | TotalTax | TotalNet | Table1Gross | Table2Gross | Table3Gross |
** "Total" columns are sums of the respective columns of all records sharing the date.
** One or two of the "Table(n)Gross" may be zero