|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
tblAssignments
ass_id ass_user_id ass_cty_id ass_crd_start ass_crd_end (Ending Number) tblCards crd_id crd_cty_id crd_start_num crd_end_num crd_desc tblCardTypes cty_id cty_name cty_desc state of tblCardTypes cty_id cty_name cty_desc 1 Gold some desc state of tblCards crd_id crd_cty_id crd_start_num crd_end_num crd_desc 1 1 1 10000 some desc state of tblAssignments ass_id ass_user_id ass_cty_id ass_cd_start ass_cd_end 1 1 1 1 100 2 2 1 200 250 3 1 1 150 175 4 2 1 5000 7000 some information about the table structure tblCardTypes stores the card category information. TblCards hold the information about the cards. There are 9999 cards in the category Gold. TblAssignments contains the information about the users who are assigned ranges from cards. As you can see the user with id 1 is assigned cards from 1-100,150-175 From Gold Category. Now user with id 2 is assigned card range from 200-250,5000-7000. now I want t show the breakthrough(the card ranges that are now assigned yet) in this case cards from 101-149,176-199,251-4999,7001-10000 can anyone help me with the query. Please Help, Haseeb |
|
#2
|
||||
|
||||
|
http://forums.devarticles.com/showt...=&threadid=6382 - are you guys in the same class?!
|
|
#3
|
|||
|
|||
|
Did you get an answer for this?
Personally, I don't like the layout of the tables. They are not normalized enough for my tastes. Although I recognize the significance of space savings realized by storing starting and ending numbers to represent a series of cards, I find the query efficiencies of storing a single record for each card assigned to an individual significant enough to outweigh the space storage. That's is just my opinion. As for the specific question... I don't know. I've never designed a data model that required a query like this. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > SQL Query Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|