Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 22nd, 2004, 06:03 AM
hasibiqbal hasibiqbal is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Lahore
Posts: 1 hasibiqbal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question SQL Query Help

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
Attached Files
File Type: htm query help.htm (14.3 KB, 242 views)

Reply With Quote
  #2  
Old January 22nd, 2004, 08:21 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy

Reply With Quote
  #3  
Old January 27th, 2004, 09:35 PM
DocLogic DocLogic is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Wadsworth, OH
Posts: 10 DocLogic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > SQL Query Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT