|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
tblAssignments
***_id ***_user_id ***_cty_id ***_crd_start ***_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 ***_id ***_user_id ***_cty_id ***_cd_start ***_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 |
|
#3
|
|||
|
|||
|
but that solution is oracle speacific. can anyone know how to do this using sql server?
|
|
#4
|
||||
|
||||
|
it's a really tough problem, the gaps
i would recommend you take tony's solution and substitute your own column/table names and try it instead of SELECT x,y FROM DUAL, in sql server all you have to say is SELECT x,y also, just replace NVL with COALESCE good luck |
|
#5
|
|||
|
|||
|
i have tried but no luck. the query doesnt retun anything.
|
|
#6
|
|||
|
|||
|
the query return nothin.can we use procedure for this???
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > SQL Query Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|