| | |
Pulling from two SQL tables and displaying data
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2009
Posts: 1
Reputation:
Solved Threads: 0
Can someone help and show me how to display using (VB.net) these two tables combined into one. I'm really struggling trying to figure this out after hours of work, I decided its time to ask for help!
So in SQL Server 2005 I have the following tables...
Students
PKId
Cart_Id
Fname
Lname
Credits (will not always equal one)
Items_Ordered
PkId
Cart_Id
Product_Id
Quantity (will always be one)
The following is what has to happen...
The total amount of credits should always equal the total quantity of items ordered for that Cart_Id.
Now, the amount of Students there are for each purchase will vary from 1 - 4 and the credits need to be distributed evenly.
If there is an uneven Quantity versus Student count, then the credits will be allocated from top to bottom, adding an extra to each
of those students.
So when it comes down to it, I need Students.Fname and Students.Lname put into each line of the Items_Ordered table for that Cart_id, distributed evenly.
I would really appreciate any help on this, as I am almost brain dead now.
Thanks!
So in SQL Server 2005 I have the following tables...
Students
PKId
Cart_Id
Fname
Lname
Credits (will not always equal one)
Items_Ordered
PkId
Cart_Id
Product_Id
Quantity (will always be one)
The following is what has to happen...
The total amount of credits should always equal the total quantity of items ordered for that Cart_Id.
Now, the amount of Students there are for each purchase will vary from 1 - 4 and the credits need to be distributed evenly.
If there is an uneven Quantity versus Student count, then the credits will be allocated from top to bottom, adding an extra to each
of those students.
So when it comes down to it, I need Students.Fname and Students.Lname put into each line of the Items_Ordered table for that Cart_id, distributed evenly.
I would really appreciate any help on this, as I am almost brain dead now.
Thanks!
Last edited by tate-u; Sep 10th, 2009 at 12:18 pm.
To me it looks like you will have to write stored procedure, to handle the case of I cannot think of a single query (like some join) possibly doing it. Another thing I noticed is, you need to give a sample of input (records from 2 tables) and output expected. Your question is not all that clear to me
•
•
•
•
If there is an uneven Quantity versus Student count, then the credits will be allocated from top to bottom, adding an extra to each of those students.
![]() |
Similar Threads
- Saving and displaying data on datagrid! (VB.NET)
- SQL Tables instead of LISTS (ASP.NET)
- After migration ASP.Net 1.1 to 3.5: TreeView control is not displaying data in hierar (ASP.NET)
- problem in displaying data from mysql table.. (PHP)
- Displaying data from a MySQL db using php (PHP)
- problems in displaying data in datagrid in ASP.NET (ASP.NET)
- Tables (HTML and CSS)
- SQL Tables export (VB.NET)
- displaying data onto a web page (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Searching Record with ASP.Net
- Next Thread: dynamically binding dataset to crystal report
| Thread Tools | Search this Thread |
"crystal .net 2008 access advanced ajax app application asp asp.net autocomplete beginner bing c# c++ connectingtodatabaseinuse connection connectionstring control count crystalreport cuesent cursor data database datagrid datagridview delphi developer development display editor excel expose firewall folder ftp google hacker hint images integration java linux loop map maximum memory microsoft mobile ms msdn networking news number objects office permission php play printing problem project qt query relationaldatabases remote report reports" save savedialog search security server sets settings sharepoint sms soap socket software sophos sql sqldatbase sqlserver sqlserver2005 survey upload uploadatextfile vb vb.net video view vista visualbasic visualbasic.net visualstudio visualstudio.net web wizard






