943,519 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1964
  • ASP.NET RSS
Sep 10th, 2009
0

Pulling from two SQL tables and displaying data

Expand Post »
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!
Last edited by tate-u; Sep 10th, 2009 at 12:18 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tate-u is offline Offline
1 posts
since Sep 2009
Sep 12th, 2009
0

Re: Pulling from two SQL tables and displaying data

Hi
if i understood correctly, u need a SQL query after joining those two tables ??

Pls. gimme what columns u needed from each of these tables and where conditions if any...
Reputation Points: 12
Solved Threads: 38
Junior Poster
reach_yousuf is offline Offline
194 posts
since Sep 2007
Sep 12th, 2009
0

Re: Pulling from two SQL tables and displaying data

To me it looks like you will have to write stored procedure, to handle the case of
Quote ...
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.
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
Reputation Points: 53
Solved Threads: 20
Junior Poster in Training
padtes is offline Offline
82 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Searching Record with ASP.Net
Next Thread in ASP.NET Forum Timeline: dynamically binding dataset to crystal report





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC