Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Urgently need help with quartiles in sql

Author  Topic 

snigrini
Starting Member

4 Posts

Posted - 2015-05-06 : 06:53:00
Hi. Can someone please help me with the following query? It is as follows:
Display all the distinct orders where the quantity is in the bottom quartile (in other
words, show all the orders which is in the lowest quarter of orders – lowest 25%).

I have the following data:
Columns:[OrderID],[ProductID],[UnitPrice],[Quantity],[Discount]
10248 42 9.80 10 0
OrderID ProductID UnitPrice Quantity Discount
10248 11 14.00 12 0
10248 42 9.80 10 0
10248 72 34.80 5 0
10249 14 18.60 9 0
10249 51 42.40 40 0
10250 41 7.70 10 0
10250 51 42.40 35 0.15
10250 65 16.80 15 0.15
10251 22 16.80 6 0.05
10251 57 15.60 15 0.05
10251 65 16.80 20 0
10252 20 64.80 40 0.05
10252 33 2.00 25 0.05
10252 60 27.20 40 0
10253 31 10.00 20 0
10253 39 14.40 42 0
10253 49 16.00 40 0
10254 24 3.60 15 0.15
10254 55 19.20 21 0.15
10254 74 8.00 21 0
10255 2 15.20 20 0
10255 16 13.90 35 0
10255 36 15.20 25 0
10255 59 44.00 30 0
10256 53 26.20 15 0
10256 77 10.40 12 0
10257 27 35.10 25 0
10257 39 14.40 6 0
10257 77 10.40 15 0
10258 2 15.20 50 0.2
10258 5 17.00 65 0.2
10258 32 25.60 6 0.2
10259 21 8.00 10 0
10259 37 20.80 1 0
10260 41 7.70 16 0.25
10260 57 15.60 50 0
10260 62 39.40 15 0.25
10260 70 12.00 21 0.25
10261 21 8.00 20 0
10261 35 14.40 20 0
10262 5 17.00 12 0.2
10262 7 24.00 15 0
10262 56 30.40 2 0
10263 16 13.90 60 0.25
10263 24 3.60 28 0
10263 30 20.70 60 0.25
10263 74 8.00 36 0.25
10264 2 15.20 35 0
10264 41 7.70 25 0.15
10265 17 31.20 30 0
10265 70 12.00 20 0
10266 12 30.40 12 0.05
10267 40 14.70 50 0
10267 59 44.00 70 0.15
10267 76 14.40 15 0.15
10268 29 99.00 10 0
10268 72 27.80 4 0
10269 33 2.00 60 0.05
10269 72 27.80 20 0.05
10270 36 15.20 30 0
10270 43 36.80 25 0
10271 33 2.00 24 0
10272 20 64.80 6 0
10272 31 10.00 40 0
10272 72 27.80 24 0
10273 10 24.80 24 0.05
10273 31 10.00 15 0.05
10273 33 2.00 20 0
10273 40 14.70 60 0.05
10273 76 14.40 33 0.05
10274 71 17.20 20 0
10274 72 27.80 7 0
10275 24 3.60 12 0.05
10275 59 44.00 6 0.05
10276 10 24.80 15 0
10276 13 4.80 10 0
10277 28 36.40 20 0
10277 62 39.40 12 0
10278 44 15.50 16 0
10278 59 44.00 15 0
10278 63 35.10 8 0
10278 73 12.00 25 0
10279 17 31.20 15 0.25
10280 24 3.60 12 0
10280 55 19.20 20 0
10280 75 6.20 30 0
10281 19 7.30 1 0
10281 24 3.60 6 0
10281 35 14.40 4 0
10282 30 20.70 6 0
10282 57 15.60 2 0
10283 15 12.40 20 0
10283 19 7.30 18 0
10283 60 27.20 35 0
10283 72 27.80 3 0
10284 27 35.10 15 0.25
10284 44 15.50 21 0
10284 60 27.20 20 0.25
10284 67 11.20 5 0.25
10285 1 14.40 45 0.2
10285 40 14.70 40 0.2
10285 53 26.20 36 0.2
10286 35 14.40 100 0
10286 62 39.40 40 0
10287 16 13.90 40 0.15
10287 34 11.20 20 0
10287 46 9.60 15 0.15
10288 54 5.90 10 0.1
10288 68 10.00 3 0.1
10289 3 8.00 30 0
10289 64 26.60 9 0
10290 5 17.00 20 0
10290 29 99.00 15 0
10290 49 16.00 15 0
10290 77 10.40 10 0
10291 13 4.80 20 0.1
10291 44 15.50 24 0.1
10291 51 42.40 2 0.1
10292 20 64.80 20 0
10293 18 50.00 12 0
10293 24 3.60 10 0
10293 63 35.10 5 0
10293 75 6.20 6 0
10294 1 14.40 18 0
10294 17 31.20 15 0
10294 43 36.80 15 0
10294 60 27.20 21 0
10294 75 6.20 6 0
10295 56 30.40 4 0
10296 11 16.80 12 0
10296 16 13.90 30 0
10296 69 28.80 15 0
10297 39 14.40 60 0
10297 72 27.80 20 0
10298 2 15.20 40 0
10298 36 15.20 40 0.25
10298 59 44.00 30 0.25
10298 62 39.40 15 0
10299 19 7.30 15 0
10299 70 12.00 20 0
10300 66 13.60 30 0
10300 68 10.00 20 0
10301 40 14.70 10 0
10301 56 30.40 20 0
10302 17 31.20 40 0
10302 28 36.40 28 0
10302 43 36.80 12 0
10303 40 14.70 40 0.1
10303 65 16.80 30 0.1
10303 68 10.00 15 0.1
10304 49 16.00 30 0
10304 59 44.00 10 0
10304 71 17.20 2 0
10305 18 50.00 25 0.1
10305 29 99.00 25 0.1
10305 39 14.40 30 0.1
10306 30 20.70 10 0
10306 53 26.20 10 0
10306 54 5.90 5 0
10307 62 39.40 10 0
10307 68 10.00 3 0
10308 69 28.80 1 0
10308 70 12.00 5 0
10309 4 17.60 20 0
10309 6 20.00 30 0
10309 42 11.20 2 0
10309 43 36.80 20 0
10309 71 17.20 3 0
10310 16 13.90 10 0
10310 62 39.40 5 0
10311 42 11.20 6 0
10311 69 28.80 7 0
10312 28 36.40 4 0
10312 43 36.80 24 0
10312 53 26.20 20 0
10312 75 6.20 10 0
10313 36 15.20 12 0
10314 32 25.60 40 0.1
10314 58 10.60 30 0.1
10314 62 39.40 25 0.1
10315 34 11.20 14 0
10315 70 12.00 30 0
10316 41 7.70 10 0
10316 62 39.40 70 0
10317 1 14.40 20 0
10318 41 7.70 20 0
10318 76 14.40 6 0
10319 17 31.20 8 0
10319 28 36.40 14 0
10319 76 14.40 30 0
10320 71 17.20 30 0
10321 35 14.40 10 0
10322 52 5.60 20 0
10323 15 12.40 5 0
10323 25 11.20 4 0
10323 39 14.40 4 0
10324 16 13.90 21 0.15
10324 35 14.40 70 0.15
10324 46 9.60 30 0
10324 59 44.00 40 0.15
10324 63 35.10 80 0.15
10325 6 20.00 6 0
10325 13 4.80 12 0
10325 14 18.60 9 0
10325 31 10.00 4 0
10325 72 27.80 40 0
10326 4 17.60 24 0
10326 57 15.60 16 0
10326 75 6.20 50 0
10327 2 15.20 25 0.2
10327 11 16.80 50 0.2
10327 30 20.70 35 0.2
10327 58 10.60 30 0.2
10328 59 44.00 9 0
10328 65 16.80 40 0
10328 68 10.00 10 0
10329 19 7.30 10 0.05
10329 30 20.70 8 0.05
10329 38 210.80 20 0.05
10329 56 30.40 12 0.05
10330 26 24.90 50 0.15
10330 72 27.80 25 0.15
10331 54 5.90 15 0
10332 18 50.00 40 0.2
10332 42 11.20 10 0.2
10332 47 7.60 16 0.2
10333 14 18.60 10 0
10333 21 8.00 10 0.1
10333 71 17.20 40 0.1
10334 52 5.60 8 0
10334 68 10.00 10 0
10335 2 15.20 7 0.2
10335 31 10.00 25 0.2
10335 32 25.60 6 0.2
10335 51 42.40 48 0.2
10336 4 17.60 18 0.1
10337 23 7.20 40 0
10337 26 24.90 24 0
10337 36 15.20 20 0
10337 37 20.80 28 0
10337 72 27.80 25 0
10338 17 31.20 20 0
10338 30 20.70 15 0
10339 4 17.60 10 0
10339 17 31.20 70 0.05
10339 62 39.40 28 0
10340 18 50.00 20 0.05
10340 41 7.70 12 0.05
10340 43 36.80 40 0.05
10341 33 2.00 8 0
10341 59 44.00 9 0.15
10342 2 15.20 24 0.2
10342 31 10.00 56 0.2
10342 36 15.20 40 0.2
10342 55 19.20 40 0.2
10343 64 26.60 50 0
10343 68 10.00 4 0.05
10343 76 14.40 15 0
10344 4 17.60 35 0
10344 8 32.00 70 0.25
10345 8 32.00 70 0
10345 19 7.30 80 0
10345 42 11.20 9 0
10346 17 31.20 36 0.1
10346 56 30.40 20 0
10347 25 11.20 10 0
10347 39 14.40 50 0.15
10347 40 14.70 4 0
10347 75 6.20 6 0.15
10348 1 14.40 15 0.15
10348 23 7.20 25 0
10349 54 5.90 24 0
10350 50 13.00 15 0.1
10350 69 28.80 18 0.1
10351 38 210.80 20 0.05
10351 41 7.70 13 0
10351 44 15.50 77 0.05
10351 65 16.80 10 0.05
10352 24 3.60 10 0
10352 54 5.90 20 0.15
10353 11 16.80 12 0.2
10353 38 210.80 50 0.2
10354 1 14.40 12 0
10354 29 99.00 4 0
10355 24 3.60 25 0
10355 57 15.60 25 0
10356 31 10.00 30 0
10356 55 19.20 12 0
10356 69 28.80 20 0
10357 10 24.80 30 0.2
10357 26 24.90 16 0
10357 60 27.20 8 0.2
10358 24 3.60 10 0.05
10358 34 11.20 10 0.05
10358 36 15.20 20 0.05
10359 16 13.90 56 0.05
10359 31 10.00 70 0.05
10359 60 27.20 80 0.05
10360 28 36.40 30 0
10360 29 99.00 35 0
10360 38 210.80 10 0
10360 49 16.00 35 0
10360 54 5.90 28 0
10361 39 14.40 54 0.1
10361 60 27.20 55 0.1
10362 25 11.20 50 0
10362 51 42.40 20 0
10362 54 5.90 24 0
10363 31 10.00 20 0
10363 75 6.20 12 0
10363 76 14.40 12 0
10364 69 28.80 30 0
10364 71 17.20 5 0
10365 11 16.80 24 0
10366 65 16.80 5 0
10366 77 10.40 5 0
10367 34 11.20 36 0
10367 54 5.90 18 0
10367 65 16.80 15 0
10367 77 10.40 7 0
10368 21 8.00 5 0.1
10368 28 36.40 13 0.1
10368 57 15.60 25 0
10368 64 26.60 35 0.1
10369 29 99.00 20 0
10369 56 30.40 18 0.25
10370 1 14.40 15 0.15
10370 64 26.60 30 0
10370 74 8.00 20 0.15
10371 36 15.20 6 0.2
10372 20 64.80 12 0.25
10372 38 210.80 40 0.25
10372 60 27.20 70 0.25
10372 72 27.80 42 0.25
10373 58 10.60 80 0.2
10373 71 17.20 50 0.2
10374 31 10.00 30 0
10374 58 10.60 15 0
10375 14 18.60 15 0
10375 54 5.90 10 0
10376 31 10.00 42 0.05
10377 28 36.40 20 0.15
10377 39 14.40 20 0.15
10378 71 17.20 6 0
10379 41 7.70 8 0.1
10379 63 35.10 16 0.1
10379 65 16.80 20 0.1
10380 30 20.70 18 0.1
10380 53 26.20 20 0.1
10380 60 27.20 6 0.1
10380 70 12.00 30 0
10381 74 8.00 14 0
10382 5 17.00 32 0
10382 18 50.00 9 0
10382 29 99.00 14 0
10382 33 2.00 60 0
10382 74 8.00 50 0
10383 13 4.80 20 0
10383 50 13.00 15 0
10383 56 30.40 20 0
10384 20 64.80 28 0
10384 60 27.20 15 0
10385 7 24.00 10 0.2
10385 60 27.20 20 0.2
10385 68 10.00 8 0.2
10386 24 3.60 15 0
10386 34 11.20 10 0
10387 24 3.60 15 0
10387 28 36.40 6 0
10387 59 44.00 12 0
10387 71 17.20 15 0
10388 45 7.60 15 0.2
10388 52 5.60 20 0.2
10388 53 26.20 40 0
10389 10 24.80 16 0
10389 55 19.20 15 0
10389 62 39.40 20 0
10389 70 12.00 30 0
10390 31 10.00 60 0.1
10390 35 14.40 40 0.1
10390 46 9.60 45 0
10390 72 27.80 24 0.1
10391 13 4.80 18 0
10392 69 28.80 50 0
10393 2 15.20 25 0.25
10393 14 18.60 42 0.25
10393 25 11.20 7 0.25
10393 26 24.90 70 0.25
10393 31 10.00 32 0
10394 13 4.80 10 0
10394 62 39.40 10 0
10395 46 9.60 28 0.1
10395 53 26.20 70 0.1
10395 69 28.80 8 0
10396 23 7.20 40 0
10396 71 17.20 60 0
10396 72 27.80 21 0
10397 21 8.00 10 0.15
10397 51 42.40 18 0.15
10398 35 14.40 30 0
10398 55 19.20 120 0.1
10399 68 10.00 60 0
10399 71 17.20 30 0
10399 76 14.40 35 0
10399 77 10.40 14 0
10400 29 99.00 21 0
10400 35 14.40 35 0
10400 49 16.00 30 0
10401 30 20.70 18 0
10401 56 30.40 70 0
10401 65 16.80 20 0
10401 71 17.20 60 0
10402 23 7.20 60 0
10402 63 35.10 65 0
10403 16 13.90 21 0.15
10403 48 10.20 70 0.15
10404 26 24.90 30 0.05
10404 42 11.20 40 0.05
10404 49 16.00 30 0.05
10405 3 8.00 50 0
10406 1 14.40 10 0
10406 21 8.00 30 0.1
10406 28 36.40 42 0.1
10406 36 15.20 5 0.1
10406 40 14.70 2 0.1
10407 11 16.80 30 0
10407 69 28.80 15 0
10407 71 17.20 15 0
10408 37 20.80 10 0
10408 54 5.90 6 0
10408 62 39.40 35 0
10409 14 18.60 12 0
10409 21 8.00 12 0
10410 33 2.00 49 0
10410 59 44.00 16 0
10411 41 7.70 25 0.2
10411 44 15.50 40 0.2
10411 59 44.00 9 0.2
10412 14 18.60 20 0.1
10413 1 14.40 24 0
10413 62 39.40 40 0
10413 76 14.40 14 0
10414 19 7.30 18 0.05
10414 33 2.00 50 0
10415 17 31.20 2 0
10415 33 2.00 20 0
10416 19 7.30 20 0
10416 53 26.20 10 0
10416 57 15.60 20 0
10417 38 210.80 50 0
10417 46 9.60 2 0.25
10417 68 10.00 36 0.25
10417 77 10.40 35 0
10418 2 15.20 60 0
10418 47 7.60 55 0
10418 61 22.80 16 0
10418 74 8.00 15 0
10419 60 27.20 60 0.05
10419 69 28.80 20 0.05
10420 9 77.60 20 0.1
10420 13 4.80 2 0.1
10420 70 12.00 8 0.1
10420 73 12.00 20 0.1
10421 19 7.30 4 0.15
10421 26 24.90 30 0
10421 53 26.20 15 0.15
10421 77 10.40 10 0.15
10422 26 24.90 2 0
10423 31 10.00 14 0
10423 59 44.00 20 0
10424 35 14.40 60 0.2
10424 38 210.80 49 0.2
10424 68 10.00 30 0.2
10425 55 19.20 10 0.25
10425 76 14.40 20 0.25
10426 56 30.40 5 0
10426 64 26.60 7 0
10427 14 18.60 35 0
10428 46 9.60 20 0
10429 50 13.00 40 0
10429 63 35.10 35 0.25
10430 17 31.20 45 0.2
10430 21 8.00 50 0
10430 56 30.40 30 0
10430 59 44.00 70 0.2
10431 17 31.20 50 0.25
10431 40 14.70 50 0.25
10431 47 7.60 30 0.25
10432 26 24.90 10 0
10432 54 5.90 40 0
10433 56 30.40 28 0
10434 11 16.80 6 0
10434 76 14.40 18 0.15
10435 2 15.20 10 0
10435 22 16.80 12 0
10435 72 27.80 10 0
10436 46 9.60 5 0
10436 56 30.40 40 0.1
10436 64 26.60 30 0.1
10436 75 6.20 24 0.1
10437 53 26.20 15 0
10438 19 7.30 15 0.2
10438 34 11.20 20 0.2
10438 57 15.60 15 0.2
10439 12 30.40 15 0
10439 16 13.90 16 0
10439 64 26.60 6 0
10439 74 8.00 30 0
10440 2 15.20 45 0.15
10440 16 13.90 49 0.15
10440 29 99.00 24 0.15
10440 61 22.80 90 0.15
10441 27 35.10 50 0
10442 11 16.80 30 0
10442 54 5.90 80 0
10442 66 13.60 60 0
10443 11 16.80 6 0.2
10443 28 36.40 12 0
10444 17 31.20 10 0
10444 26 24.90 15 0
10444 35 14.40 8 0
10444 41 7.70 30 0
10445 39 14.40 6 0
10445 54 5.90 15 0
10446 19 7.30 12 0.1
10446 24 3.60 20 0.1
10446 31 10.00 3 0.1
10446 52 5.60 15 0.1
10447 19 7.30 40 0
10447 65 16.80 35 0
10447 71 17.20 2 0
10448 26 24.90 6 0
10448 40 14.70 20 0
10449 10 24.80 14 0
10449 52 5.60 20 0
10449 62 39.40 35 0
10450 10 24.80 20 0.2
10450 54 5.90 6 0.2
10451 55 19.20 120 0.1
10451 64 26.60 35 0.1
10451 65 16.80 28 0.1
10451 77 10.40 55 0.1
10452 28 36.40 15 0
10452 44 15.50 100 0.05
10453 48 10.20 15 0.1
10453 70 12.00 25 0.1
10454 16 13.90 20 0.2
10454 33 2.00 20 0.2
10454 46 9.60 10 0.2
10455 39 14.40 20 0
10455 53 26.20 50 0
10455 61 22.80 25 0
10455 71 17.20 30 0
10456 21 8.00 40 0.15
10456 49 16.00 21 0.15
10457 59 44.00 36 0
10458 26 24.90 30 0
10458 28 36.40 30 0
10458 43 36.80 20 0
10458 56 30.40 15 0
10458 71 17.20 50 0
10459 7 24.00 16 0.05
10459 46 9.60 20 0.05
10459 72 27.80 40 0
10460 68 10.00 21 0.25
10460 75 6.20 4 0.25
10461 21 8.00 40 0.25
10461 30 20.70 28 0.25
10461 55 19.20 60 0.25
10462 13 4.80 1 0
10462 23 7.20 21 0
10463 19 7.30 21 0
10463 42 11.20 50 0
10464 4 17.60 16 0.2
10464 43 36.80 3 0
10464 56 30.40 30 0.2
10464 60 27.20 20 0
10465 24 3.60 25 0
10465 29 99.00 18 0.1
10465 40 14.70 20 0
10465 45 7.60 30 0.1
10465 50 13.00 25 0
10466 11 16.80 10 0
10466 46 9.60 5 0
10467 24 3.60 28 0
10467 25 11.20 12 0
10468 30 20.70 8 0
10468 43 36.80 15 0
10469 2 15.20 40 0.15
10469 16 13.90 35 0.15
10469 44 15.50 2 0.15
10470 18 50.00 30 0
10470 23 7.20 15 0
10470 64 26.60 8 0
10471 7 24.00 30 0
10471 56 30.40 20 0
10472 24 3.60 80 0.05
10472 51 42.40 18 0
10473 33 2.00 12 0
10473 71 17.20 12 0
10474 14 18.60 12 0
10474 28 36.40 18 0
10474 40 14.70 21 0
10474 75 6.20 10 0
10475 31 10.00 35 0.15
10475 66 13.60 60 0.15
10475 76 14.40 42 0.15
10476 55 19.20 2 0.05
10476 70 12.00 12 0
10477 1 14.40 15 0
10477 21 8.00 21 0.25
10477 39 14.40 20 0.25
10478 10 24.80 20 0.05
10479 38 210.80 30 0
10479 53 26.20 28 0
10479 59 44.00 60 0
10479 64 26.60 30 0
10480 47 7.60 30 0
10480 59 44.00 12 0
10481 49 16.00 24 0
10481 60 27.20 40 0
10482 40 14.70 10 0
10483 34 11.20 35 0.05
10483 77 10.40 30 0.05
10484 21 8.00 14 0
10484 40 14.70 10 0
10484 51 42.40 3 0
10485 2 15.20 20 0.1
10485 3 8.00 20 0.1
10485 55 19.20 30 0.1
10485 70 12.00 60 0.1
10486 11 16.80 5 0
10486 51 42.40 25 0
10486 74 8.00 16 0
10487 19 7.30 5 0
10487 26 24.90 30 0
10487 54 5.90 24 0.25
10488 59 44.00 30 0
10488 73 12.00 20 0.2
10489 11 16.80 15 0.25
10489 16 13.90 18 0
10490 59 44.00 60 0
10490 68 10.00 30 0
10490 75 6.20 36 0
10491 44 15.50 15 0.15
10491 77 10.40 7 0.15
10492 25 11.20 60 0.05
10492 42 11.20 20 0.05
10493 65 16.80 15 0.1
10493 66 13.60 10 0.1
10493 69 28.80 10 0.1
10494 56 30.40 30 0
10495 23 7.20 10 0
10495 41 7.70 20 0
10495 77 10.40 5 0
10496 31 10.00 20 0.05
10497 56 30.40 14 0
10497 72 27.80 25 0
10497 77 10.40 25 0
10498 24 4.50 14 0
10498 40 18.40 5 0
10498 42 14.00 30 0
10499 28 45.60 20 0
10499 49 20.00 25 0
10500 15 15.50 12 0.05
10500 28 45.60 8 0.05
10501 54 7.45 20 0
10502 45 9.50 21 0
10502 53 32.80 6 0
10502 67 14.00 30 0
10503 14 23.25 70 0
10503 65 21.05 20 0
10504 2 19.00 12 0
10504 21 10.00 12 0
10504 53 32.80 10 0
10504 61 28.50 25 0
10505 62 49.30 3 0
10506 25 14.00 18 0.1
10506 70 15.00 14 0.1
10507 43 46.00 15 0.15
10507 48 12.75 15 0.15
10508 13 6.00 10 0
10508 39 18.00 10 0
10509 28 45.60 3 0
10510 29 123.79 36 0
10510 75 7.75 36 0.1
10511 4 22.00 50 0.15
10511 7 30.00 50 0.15
10511 8 40.00 10 0.15
10512 24 4.50 10 0.15
10512 46 12.00 9 0.15
10512 47 9.50 6 0.15
10512 60 34.00 12 0.15
10513 21 10.00 40 0.2
10513 32 32.00 50 0.2
10513 61 28.50 15 0.2
10514 20 81.00 39 0
10514 28 45.60 35 0
10514 56 38.00 70 0
10514 65 21.05 39 0
10514 75 7.75 50 0
10515 9 97.00 16 0.15
10515 16 17.45 50 0
10515 27 43.90 120 0
10515 33 2.50 16 0.15
10515 60 34.00 84 0.15
10516 18 62.50 25 0.1
10516 41 9.65 80 0.1
10516 42 14.00 20 0
10517 52 7.00 6 0
10517 59 55.00 4 0
10517 70 15.00 6 0
10518 24 4.50 5 0
10518 38 263.50 15 0
10518 44 19.45 9 0
10519 10 31.00 16 0.05
10519 56 38.00 40 0
10519 60 34.00 10 0.05
10520 24 4.50 8 0
10520 53 32.80 5 0
10521 35 18.00 3 0
10521 41 9.65 10 0
10521 68 12.50 6 0
10522 1 18.00 40 0.2
10522 8 40.00 24 0
10522 30 25.89 20 0.2
10522 40 18.40 25 0.2
10523 17 39.00 25 0.1
10523 20 81.00 15 0.1
10523 37 26.00 18 0.1
10523 41 9.65 6 0.1
10524 10 31.00 2 0
10524 30 25.89 10 0
10524 43 46.00 60 0
10524 54 7.45 15 0
10525 36 19.00 30 0
10525 40 18.40 15 0.1
10526 1 18.00 8 0.15
10526 13 6.00 10 0
10526 56 38.00 30 0.15
10527 4 22.00 50 0.1
10527 36 19.00 30 0.1
10528 11 21.00 3 0
10528 33 2.50 8 0.2
10528 72 34.80 9 0
10529 55 24.00 14 0
10529 68 12.50 20 0
10529 69 36.00 10 0
10530 17 39.00 40 0
10530 43 46.00 25 0
10530 61 28.50 20 0
10530 76 18.00 50 0
10531 59 55.00 2 0
10532 30 25.89 15 0
10532 66 17.00 24 0
10533 4 22.00 50 0.05
10533 72 34.80 24 0
10533 73 15.00 24 0.05
10534 30 25.89 10 0
10534 40 18.40 10 0.2
10534 54 7.45 10 0.2
10535 11 21.00 50 0.1
10535 40 18.40 10 0.1
10535 57 19.50 5 0.1
10535 59 55.00 15 0.1
10536 12 38.00 15 0.25
10536 31 12.50 20 0
10536 33 2.50 30 0
10536 60 34.00 35 0.25
10537 31 12.50 30 0
10537 51 53.00 6 0
10537 58 13.25 20 0
10537 72 34.80 21 0
10537 73 15.00 9 0
10538 70 15.00 7 0
10538 72 34.80 1 0
10539 13 6.00 8 0
10539 21 10.00 15 0
10539 33 2.50 15 0
10539 49 20.00 6 0
10540 3 10.00 60 0
10540 26 31.23 40 0
10540 38 263.50 30 0
10540 68 12.50 35 0
10541 24 4.50 35 0.1
10541 38 263.50 4 0.1
10541 65 21.05 36 0.1
10541 71 21.50 9 0.1
10542 11 21.00 15 0.05
10542 54 7.45 24 0.05
10543 12 38.00 30 0.15
10543 23 9.00 70 0.15
10544 28 45.60 7 0
10544 67 14.00 7 0
10545 11 21.00 10 0
10546 7 30.00 10 0
10546 35 18.00 30 0
10546 62 49.30 40 0
10547 32 32.00 24 0.15
10547 36 19.00 60 0
10548 34 14.00 10 0.25
10548 41 9.65 14 0
10549 31 12.50 55 0.15
10549 45 9.50 100 0.15
10549 51 53.00 48 0.15
10550 17 39.00 8 0.1
10550 19 9.20 10 0
10550 21 10.00 6 0.1
10550 61 28.50 10 0.1
10551 16 17.45 40 0.15
10551 35 18.00 20 0.15
10551 44 19.45 40 0
10552 69 36.00 18 0
10552 75 7.75 30 0
10553 11 21.00 15 0
10553 16 17.45 14 0
10553 22 21.00 24 0
10553 31 12.50 30 0
10553 35 18.00 6 0
10554 16 17.45 30 0.05
10554 23 9.00 20 0.05
10554 62 49.30 20 0.05
10554 77 13.00 10 0.05
10555 14 23.25 30 0.2
10555 19 9.20 35 0.2
10555 24 4.50 18 0.2
10555 51 53.00 20 0.2
10555 56 38.00 40 0.2
10556 72 34.80 24 0
10557 64 33.25 30 0
10557 75 7.75 20 0
10558 47 9.50 25 0
10558 51 53.00 20 0
10558 52 7.00 30 0
10558 53 32.80 18 0
10558 73 15.00 3 0
10559 41 9.65 12 0.05
10559 55 24.00 18 0.05
10560 30 25.89 20 0
10560 62 49.30 15 0.25
10561 44 19.45 10 0
10561 51 53.00 50 0
10562 33 2.50 20 0.1
10562 62 49.30 10 0.1
10563 36 19.00 25 0
10563 52 7.00 70 0
10564 17 39.00 16 0.05
10564 31 12.50 6 0.05
10564 55 24.00 25 0.05
10565 24 4.50 25 0.1
10565 64 33.25 18 0.1
10566 11 21.00 35 0.15
10566 18 62.50 18 0.15
10566 76 18.00 10 0
10567 31 12.50 60 0.2
10567 51 53.00 3 0
10567 59 55.00 40 0.2
10568 10 31.00 5 0
10569 31 12.50 35 0.2
10569 76 18.00 30 0
10570 11 21.00 15 0.05
10570 56 38.00 60 0.05
10571 14 23.25 11 0.15
10571 42 14.00 28 0.15
10572 16 17.45 12 0.1
10572 32 32.00 10 0.1
10572 40 18.40 50 0
10572 75 7.75 15 0.1
10573 17 39.00 18 0
10573 34 14.00 40 0
10573 53 32.80 25 0
10574 33 2.50 14 0
10574 40 18.40 2 0
10574 62 49.30 10 0
10574 64 33.25 6 0
10575 59 55.00 12 0
10575 63 43.90 6 0
10575 72 34.80 30 0
10575 76 18.00 10 0
10576 1 18.00 10 0
10576 31 12.50 20 0
10576 44 19.45 21 0
10577 39 18.00 10 0
10577 75 7.75 20 0
10577 77 13.00 18 0
10578 35 18.00 20 0
10578 57 19.50 6 0
10579 15 15.50 10 0
10579 75 7.75 21 0
10580 14 23.25 15 0.05
10580 41 9.65 9 0.05
10580 65 21.05 30 0.05
10581 75 7.75 50 0.2
10582 57 19.50 4 0
10582 76 18.00 14 0
10583 29 123.79 10 0
10583 60 34.00 24 0.15
10583 69 36.00 10 0.15
10584 31 12.50 50 0.05
10585 47 9.50 15 0
10586 52 7.00 4 0.15
10587 26 31.23 6 0
10587 35 18.00 20 0
10587 77 13.00 20 0
10588 18 62.50 40 0.2
10588 42 14.00 100 0.2
10589 35 18.00 4 0
10590 1 18.00 20 0
10590 77 13.00 60 0.05
10591 3 10.00 14 0
10591 7 30.00 10 0
10591 54 7.45 50 0
10592 15 15.50 25 0.05
10592 26 31.23 5 0.05
10593 20 81.00 21 0.2
10593 69 36.00 20 0.2
10593 76 18.00 4 0.2
10594 52 7.00 24 0
10594 58 13.25 30 0
10595 35 18.00 30 0.25
10595 61 28.50 120 0.25
10595 69 36.00 65 0.25
10596 56 38.00 5 0.2
10596 63 43.90 24 0.2
10596 75 7.75 30 0.2
10597 24 4.50 35 0.2
10597 57 19.50 20 0
10597 65 21.05 12 0.2
10598 27 43.90 50 0
10598 71 21.50 9 0
10599 62 49.30 10 0
10600 54 7.45 4 0
10600 73 15.00 30 0
10601 13 6.00 60 0
10601 59 55.00 35 0
10602 77 13.00 5 0.25
10603 22 21.00 48 0
10603 49 20.00 25 0.05
10604 48 12.75 6 0.1
10604 76 18.00 10 0.1
10605 16 17.45 30 0.05
10605 59 55.00 20 0.05
10605 60 34.00 70 0.05
10605 71 21.50 15 0.05
10606 4 22.00 20 0.2
10606 55 24.00 20 0.2
10606 62 49.30 10 0.2
10607 7 30.00 45 0
10607 17 39.00 100 0
10607 33 2.50 14 0
10607 40 18.40 42 0
10607 72 34.80 12 0
10608 56 38.00 28 0
10609 1 18.00 3 0
10609 10 31.00 10 0
10609 21 10.00 6 0
10610 36 19.00 21 0.25
10611 1 18.00 6 0
10611 2 19.00 10 0
10611 60 34.00 15 0
10612 10 31.00 70 0
10612 36 19.00 55 0
10612 49 20.00 18 0
10612 60 34.00 40 0
10612 76 18.00 80 0
10613 13 6.00 8 0.1
10613 75 7.75 40 0
10614 11 21.00 14 0
10614 21 10.00 8 0
10614 39 18.00 5 0
10615 55 24.00 5 0
10616 38 263.50 15 0.05
10616 56 38.00 14 0
10616 70 15.00 15 0.05
10616 71 21.50 15 0.05
10617 59 55.00 30 0.15
10618 6 25.00 70 0
10618 56 38.00 20 0
10618 68 12.50 15 0
10619 21 10.00 42 0
10619 22 21.00 40 0
10620 24 4.50 5 0
10620 52 7.00 5 0
10621 19 9.20 5 0
10621 23 9.00 10 0
10621 70 15.00 20 0
10621 71 21.50 15 0
10622 2 19.00 20 0
10622 68 12.50 18 0.2
10623 14 23.25 21 0
10623 19 9.20 15 0.1
10623 21 10.00 25 0.1
10623 24 4.50 3 0
10623 35 18.00 30 0.1
10624 28 45.60 10 0
10624 29 123.79 6 0
10624 44 19.45 10 0
10625 14 23.25 3 0
10625 42 14.00 5 0
10625 60 34.00 10 0

An example of how the output should look is:
OrderID ProductID
10602 77
and there should be 263 results displayed.

Thank-you

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2015-05-06 : 10:33:27
do you mean this?
SELECT * FROM (
SELECT *,NTILE(4) OVER(ORDER BY Quantity) AS Quartile FROM Tbl
)s WHERE Quartile = 1
Go to Top of Page

snigrini
Starting Member

4 Posts

Posted - 2015-05-07 : 12:14:15
Hi James.

That does not give me the correct answer. The answer that it gives me is as follows:

ProductID OrderIDUnitPrice Discount Quantity
37 10259 20.80 1 0 1
19 10281 7.30 1 0 1
69 10308 28.80 1 0 1
13 10462 4.80 1 0 1
72 10538 34.80 1 0 1
59 10665 55.00 1 0 1
31 10782 12.50 1 0 1
40 10807 18.40 1 0 1
30 10917 25.89 1 0 1
4 11077 22.00 1 0 1
6 11077 25.00 1 0.02 1
7 11077 30.00 1 0.05 1
10 11077 31.00 1 0 1
14 11077 23.25 1 0.03 1
20 11077 81.00 1 0.04 1
32 11077 32.00 1 0 1
66 11077 17.00 1 0 1
73 11077 15.00 2 0.01 1
77 11077 13.00 2 0 1
52 11077 7.00 2 0 1
55 11077 24.00 2 0 1
60 11077 34.00 2 0.06 1
64 11077 33.25 2 0.03 1
39 11077 18.00 2 0.05 1
23 11077 9.00 2 0 1
16 11077 17.45 2 0.03 1
12 11077 38.00 2 0.05 1
8 11077 40.00 2 0.1 1
76 11075 18.00 2 0.15 1
52 11038 7.00 2 0 1
11 10926 21.00 2 0 1
53 10933 32.80 2 0 1
28 10952 45.60 2 0 1
60 10963 34.00 2 0.15 1
72 10992 34.80 2 0 1
1 11005 18.00 2 0 1
29 11006 123.79 2 0.25 1
68 11013 12.50 2 0 1
49 11019 20.00 2 0 1
65 10806 21.05 2 0 1
62 10798 49.30 2 0 1
38 10828 263.50 2 0 1
19 10831 9.20 2 0 1
77 10835 13.00 2 0.2 1
51 10870 53.00 2 0 1
39 10784 18.00 2 0.15 1
42 10767 14.00 2 0 1
31 10774 12.50 2 0.25 1
77 10735 13.00 2 0.1 1
10 10676 31.00 2 0 1
75 10634 7.75 2 0 1
46 10643 12.00 2 0.25 1
30 10652 25.89 2 0.25 1
40 10574 18.40 2 0 1
59 10531 55.00 2 0 1
10 10524 31.00 2 0 1
44 10469 15.50 2 0.15 1
55 10476 19.20 2 0.05 1
42 10309 11.20 2 0 1
71 10304 17.20 2 0 1
57 10282 15.60 2 0 1
51 10291 42.40 2 0.1 1
56 10262 30.40 2 0 1
40 10406 14.70 2 0.1 1
17 10415 31.20 2 0 1
46 10417 9.60 2 0.25 1
13 10420 4.80 2 0.1 1
26 10422 24.90 2 0 1
71 10447 17.20 2 0 1
31 10446 10.00 3 0.1 1
68 10288 10.00 3 0.1 1
72 10283 27.80 3 0 1
71 10309 17.20 3 0 1
68 10307 10.00 3 0 1
51 10484 42.40 3 0 1
43 10464 36.80 3 0 1
62 10505 49.30 3 0 1
28 10509 45.60 3 0 1
11 10528 21.00 3 0 1
35 10521 18.00 3 0 1
73 10558 15.00 3 0 1
51 10567 53.00 3 0 1
1 10609 18.00 3 0 1
24 10623 4.50 3 0 1
14 10625 23.25 3 0 1
16 10673 17.45 3 0 1
39 10661 18.00 3 0.2 1
14 10656 23.25 3 0.1 1
31 10730 12.50 3 0.05 1
2 10722 19.00 3 0 1
53 10712 32.80 3 0.05 1
30 10719 25.89 3 0.25 1
67 10775 14.00 3 0 1
54 10781 7.45 3 0.2 1
7 10790 30.00 3 0.15 1
54 10792 7.45 3 0 1
16 10738 17.45 3 0 1
69 10752 36.00 3 0 1
40 10754 18.40 3 0 1
35 10870 18.00 3 0 1
62 10861 49.30 3 0 1
53 10867 32.80 3 0 1
9 10848 97.00 3 0 1
51 10860 53.00 3 0 1
28 10873 45.60 3 0 1
70 10900 15.00 3 0.25 1
13 10832 6.00 3 0.2 1
64 10832 33.25 3 0 1
62 10822 49.30 3 0 1
46 11019 12.00 3 0 1
70 11057 15.00 3 0 1
21 11058 10.00 3 0 1
16 11066 17.45 3 0 1
41 11077 9.65 3 0 1
46 11077 12.00 3 0.02 1
3 11077 10.00 4 0 1
75 11077 7.75 4 0 1
30 11065 25.89 4 0.25 1
55 11064 24.00 4 0.1 1
60 11060 34.00 4 0 1
61 11058 28.50 4 0 1
13 11077 6.00 4 0 1
70 11037 15.00 4 0 1
61 11042 28.50 4 0 1
12 11049 38.00 4 0.2 1
7 11023 30.00 4 0 1
42 11013 14.00 4 0 1
1 11003 18.00 4 0 1
60 10995 34.00 4 0 1
41 10989 9.65 4 0 1
64 10968 33.25 4 0 1
18 10935 62.50 4 0.25 1
59 10947 55.00 4 0 1
55 10948 24.00 4 0 1
49 10804 20.00 4 0.15 1
1 10838 18.00 4 0.25 1
51 10843 53.00 4 0.25 1
70 10858 15.00 4 0 1
33 10850 2.50 4 0.15 1
35 10864 18.00 4 0 1
45 10753 9.50 4 0 1
13 10737 6.00 4 0 1
22 10768 21.00 4 0 1
52 10725 7.00 4 0 1
66 10682 17.00 4 0 1
41 10685 9.65 4 0 1
12 10695 38.00 4 0 1
32 10705 32.00 4 0 1
5 10708 21.35 4 0 1
55 10668 24.00 4 0.1 1
18 10644 62.50 4 0.1 1
54 10600 7.45 4 0 1
57 10582 19.50 4 0 1
52 10586 7.00 4 0.15 1
35 10589 18.00 4 0 1
76 10593 18.00 4 0.2 1
38 10541 263.50 4 0.1 1
59 10517 55.00 4 0 1
75 10460 6.20 4 0.25 1
28 10312 36.40 4 0 1
25 10323 11.20 4 0 1
39 10323 14.40 4 0 1
31 10325 10.00 4 0 1
68 10343 10.00 4 0.05 1
40 10347 14.70 4 0 1
35 10281 14.40 4 0 1
56 10295 30.40 4 0 1
72 10268 27.80 4 0 1
19 10421 7.30 4 0.15 1
29 10354 99.00 4 0 1
71 10364 17.20 5 0 1
65 10366 16.80 5 0 1
77 10366 10.40 5 0 1
21 10368 8.00 5 0.1 1
56 10426 30.40 5 0 1
36 10406 15.20 5 0.1 1
46 10436 9.60 5 0 1
72 10248 34.80 5 0 1
63 10293 35.10 5 0 1
67 10284 11.20 5 0.25 1
15 10323 12.40 5 0 1
62 10310 39.40 5 0 1
54 10306 5.90 5 0 1
70 10308 12.00 5 0 1
46 10466 9.60 5 0 1
11 10486 16.80 5 0 1
19 10487 7.30 5 0 1
77 10495 10.40 5 0 1
40 10498 18.40 5 0 1
24 10518 4.50 5 0 1
53 10520 32.80 5 0 1
57 10535 19.50 5 0.1 1
56 10596 38.00 5 0.2 1
26 10592 31.23 5 0.05 1
10 10568 31.00 5 0 1
77 10602 13.00 5 0.25 1
24 10620 4.50 5 0 1
52 10620 7.00 5 0 1
19 10621 9.20 5 0 1
39 10614 18.00 5 0 1
55 10615 24.00 5 0 1
42 10625 14.00 5 0 1
23 10674 9.00 5 0 1
36 10708 19.00 5 0 1
2 10703 19.00 5 0 1
1 10700 18.00 5 0.2 1
11 10726 21.00 5 0 1
61 10724 28.50 5 0 1
21 10716 10.00 5 0 1
19 10710 9.20 5 0 1
47 10710 9.50 5 0 1
38 10783 263.50 5 0 1
28 10740 45.60 5 0.2 1
74 10753 10.00 5 0 1
14 10750 23.25 5 0.15 1
2 10851 19.00 5 0.05 1
7 10858 30.00 5 0 1
13 10898 6.00 5 0 1
25 10887 14.00 5 0 1
43 10842 46.00 5 0 1
20 10828 81.00 5 0 1
62 10802 49.30 5 0.25 1
25 10810 14.00 5 0 1
70 10810 15.00 5 0 1
11 10944 21.00 5 0.25 1
38 10964 263.50 5 0 1
72 10958 34.80 5 0 1
4 10950 22.00 5 0 1
20 10927 81.00 5 0 1
52 10927 7.00 5 0 1
47 10928 9.50 5 0 1
76 10928 18.00 5 0 1
41 10909 9.65 5 0 1
61 10910 28.50 5 0 1
26 10973 31.23 5 0 1
56 11018 38.00 5 0 1
40 11038 18.40 5 0.2 1
61 11034 28.50 6 0 1
55 11001 24.00 6 0 1
26 11004 31.23 6 0 1
76 11004 18.00 6 0 1
41 10973 9.65 6 0 1
17 10972 39.00 6 0 1
44 10978 19.45 6 0.15 1
43 10987 46.00 6 0 1
16 10916 17.45 6 0 1
32 10916 32.00 6 0 1
75 10924 7.75 6 0 1
41 10951 9.65 6 0.05 1
7 10958 30.00 6 0 1
52 10961 7.00 6 0.05 1
18 10964 62.50 6 0 1
17 10949 39.00 6 0 1
70 10822 15.00 6 0 1
51 10821 53.00 6 0 1
54 10794 7.45 6 0.2 1
6 10830 25.00 6 0 1
35 10836 18.00 6 0 1
25 10840 14.00 6 0.2 1
13 10837 6.00 6 0 1
62 10902 49.30 6 0.15 1
17 10852 39.00 6 0 1
24 10866 4.50 6 0.25 1
68 10756 12.50 6 0.2 1
36 10739 19.00 6 0 1
13 10746 6.00 6 0 1
59 10749 55.00 6 0 1
10 10775 31.00 6 0 1
22 10763 21.00 6 0 1
55 10725 24.00 6 0 1
40 10728 18.40 6 0 1
3 10702 10.00 6 0 1
4 10704 22.00 6 0 1
9 10693 97.00 6 0 1
36 10687 19.00 6 0.25 1
42 10673 14.00 6 0 1
43 10673 46.00 6 0 1
47 10656 9.50 6 0.1 1
58 10636 13.25 6 0 1
54 10654 7.45 6 0.1 1
29 10624 123.79 6 0 1
48 10604 12.75 6 0.1 1
21 10609 10.00 6 0 1
1 10611 18.00 6 0 1
64 10574 33.25 6 0 1
63 10575 43.90 6 0 1
26 10587 31.23 6 0 1
57 10578 19.50 6 0 1
51 10537 53.00 6 0 1
41 10523 9.65 6 0.1 1
68 10521 12.50 6 0 1
70 10517 15.00 6 0 1
52 10517 7.00 6 0 1
49 10539 20.00 6 0 1
21 10550 10.00 6 0.1 1
31 10564 12.50 6 0.05 1
35 10553 18.00 6 0 1
53 10502 32.80 6 0 1
47 10512 9.50 6 0.15 1
42 10311 11.20 6 0 1
6 10325 20.00 6 0 1
76 10318 14.40 6 0 1
75 10347 6.20 6 0.15 1
32 10335 25.60 6 0.2 1
30 10282 20.70 6 0 1
24 10281 3.60 6 0 1
59 10275 44.00 6 0.05 1
75 10293 6.20 6 0 1
75 10294 6.20 6 0 1
22 10251 16.80 6 0.05 1
32 10258 25.60 6 0.2 1
39 10257 14.40 6 0 1
20 10272 64.80 6 0 1
64 10439 26.60 6 0 1
39 10445 14.40 6 0 1
11 10443 16.80 6 0.2 1
26 10448 24.90 6 0 1
54 10450 5.90 6 0.2 1
54 10408 5.90 6 0 1
11 10434 16.80 6 0 1
36 10371 15.20 6 0.2 1
71 10378 17.20 6 0 1
60 10380 27.20 6 0.1 1
28 10387 36.40 6 0 1
25 10393 11.20 7 0.25 1
77 10367 10.40 7 0 1
64 10426 26.60 7 0 1
72 10274 27.80 7 0 1
2 10335 15.20 7 0.2 1
69 10311 28.80 7 0 1
77 10491 10.40 7 0.15 1
28 10544 45.60 7 0 1
67 10544 14.00 7 0 1
70 10538 15.00 7 0 1
19 10676 9.20 7 0 1
19 10697 9.20 7 0.25 1
51 10716 53.00 7 0 1
75 10773 7.75 7 0.2 1
72 10745 34.80 7 0 1
59 10757 55.00 7 0 1
54 10800 7.45 7 0.1 1
43 10819 46.00 7 0 1
13 10810 6.00 7 0 1
19 10926 9.20 7 0 1
33 10972 2.50 7 0 1
61 10998 28.50 7 0 1
13 11036 6.00 7 0 1
18 11026 62.50 8 0 1
28 11068 45.60 8 0.15 1
2 11072 19.00 8 0 1
1 11006 18.00 8 0 1
37 10966 26.00 8 0 1
18 10985 62.50 8 0.1 1
23 10935 9.00 8 0.25 1
28 10937 45.60 8 0 1
7 10940 30.00 8 0 1
51 10956 53.00 8 0 1
64 10957 33.25 8 0 1
48 10814 12.75 8 0.15 1
29 10834 123.79 8 0.05 1
35 10831 18.00 8 0 1
38 10831 263.50 8 0 1
52 10862 7.00 8 0 1
39 10899 18.00 8 0.15 1
24 10883 4.50 8 0 1
1 10752 18.00 8 0 1
31 10747 12.50 8 0 1
52 10793 7.00 8 0 1
71 10720 21.50 8 0 1
17 10698 39.00 8 0.05 1
70 10698 15.00 8 0.05 1
59 10706 55.00 8 0 1
33 10677 2.50 8 0.15 1
31 10668 12.50 8 0.1 1
18 10639 62.50 8 0 1
75 10631 7.75 8 0.1 1
13 10613 6.00 8 0.1 1
21 10614 10.00 8 0 1
13 10539 6.00 8 0 1
24 10520 4.50 8 0 1
33 10528 2.50 8 0.2 1
1 10526 18.00 8 0.15 1
17 10550 39.00 8 0.1 1
28 10500 45.60 8 0.05 1
30 10468 20.70 8 0 1
64 10470 26.60 8 0 1
17 10319 31.20 8 0 1
52 10334 5.60 8 0 1
30 10329 20.70 8 0.05 1
33 10341 2.00 8 0 1
63 10278 35.10 8 0 1
70 10420 12.00 8 0.1 1
35 10444 14.40 8 0 1
41 10379 7.70 8 0.1 1
60 10357 27.20 8 0.2 1
69 10395 28.80 8 0 1
68 10385 10.00 8 0.2 1
18 10382 50.00 9 0 1
59 10411 44.00 9 0.2 1
64 10289 26.60 9 0 1
14 10249 18.60 9 0 1
59 10341 44.00 9 0.15 1
42 10345 11.20 9 0 1
59 10328 44.00 9 0 1
14 10325 18.60 9 0 1
46 10512 12.00 9 0.15 1
71 10541 21.50 9 0.1 1
72 10528 34.80 9 0 1
44 10518 19.45 9 0 1
73 10537 15.00 9 0 1
71 10598 21.50 9 0 1
41 10580 9.65 9 0.05 1
64 10629 33.25 9 0 1
35 10697 18.00 9 0.25 1
52 10683 7.00 9 0 1
62 10746 49.30 9 0 1
63 10747 43.90 9 0 1
43 10831 46.00 9 0 1
31 10833 12.50 9 0.1 1
53 10833 32.80 9 0.1 1
70 10824 15.00 9 0 1
69 10962 36.00 9 0 1
50 10948 16.25 9 0 1
43 10982 46.00 9 0 1
46 10969 12.00 9 0 1
60 11009 34.00 9 0 1
41 11067 9.65 9 0 1
2 11049 19.00 10 0.2 1
19 11076 9.20 10 0.25 1
2 11075 19.00 10 0.15 1
11 11073 21.00 10 0 1
13 11071 6.00 10 0.05 1
33 11054 2.50 10 0 1
77 11060 13.00 10 0 1
53 11062 32.80 10 0.2 1
51 11026 53.00 10 0 1
1 11025 18.00 10 0.1 1
1 11035 18.00 10 0 1
54 11035 7.45 10 0 1
24 11051 4.50 10 0.2 1
61 11052 28.50 10 0.2 1
11 11043 21.00 10 0 1
24 11010 4.50 10 0 1
23 11013 9.00 10 0 1
18 11018 62.50 10 0 1
29 11007 123.79 10 0 1
59 11005 55.00 10 0 1
40 11003 18.40 10 0 1
52 11003 7.00 10 0 1
75 10973 7.75 10 0 1
63 10974 43.90 10 0 1
75 10975 7.75 10 0 1
51 10977 53.00 10 0 1
40 10978 18.40 10 0 1
76 10986 18.00 10 0 1
31 10945 12.50 10 0 1
2 10939 19.00 10 0.15 1
69 10964 36.00 10 0 1
24 10960 4.50 10 0.25 1
72 10926 34.80 10 0 1
13 10926 6.00 10 0 1
42 10923 14.00 10 0.2 1
43 10923 46.00 10 0.2 1
60 10917 34.00 10 0 1
17 10915 39.00 10 0 1
54 10915 7.45 10 0 1
35 10921 18.00 10 0 1
1 10911 18.00 10 0 1
49 10910 20.00 10 0 1
2 10829 19.00 10 0 1
13 10829 6.00 10 0 1
25 10832 14.00 10 0.2 1
39 10840 18.00 10 0.2 1
51 10800 53.00 10 0.1 1
34 10805 14.00 10 0 1
38 10805 263.50 10 0 1
44 10796 19.45 10 0 1
72 10798 34.80 10 0 1
10 10874 31.00 10 0 1
65 10879 21.05 10 0 1
76 10879 18.00 10 0 1
73 10881 15.00 10 0 1
34 10890 14.00 10 0 1
24 10893 4.50 10 0 1
11 10869 21.00 10 0 1
55 10872 24.00 10 0.05 1
18 10853 62.50 10 0 1
25 10851 14.00 10 0.05 1
57 10851 19.50 10 0.05 1
27 10858 43.90 10 0 1
29 10857 123.79 10 0.25 1
76 10749 18.00 10 0 1
32 10759 32.00 10 0 1
2 10792 19.00 10 0 1
31 10783 12.50 10 0 1
10 10785 31.00 10 0 1
75 10785 7.75 10 0 1
41 10778 9.65 10 0 1
29 10687 123.79 10 0 1
8 10695 40.00 10 0 1
61 10716 28.50 10 0 1
60 10709 34.00 10 0 1
65 10730 21.05 10 0.05 1
56 10727 38.00 10 0.05 1
59 10727 55.00 10 0.05 1
60 10625 34.00 10 0 1
28 10624 45.60 10 0 1
11 10637 21.00 10 0 1
4 10635 22.00 10 0.1 1
16 10671 17.45 10 0 1
62 10671 49.30 10 0 1
53 10675 32.80 10 0 1
47 10657 9.50 10 0 1
76 10665 18.00 10 0 1
65 10666 21.05 10 0 1
68 10662 12.50 10 0 1
15 10579 15.50 10 0 1
29 10583 123.79 10 0 1
69 10583 36.00 10 0.15 1
7 10591 30.00 10 0 1
62 10574 49.30 10 0 1
76 10575 18.00 10 0 1
1 10576 18.00 10 0 1
39 10577 18.00 10 0 1
76 10566 18.00 10 0 1
32 10572 32.00 10 0.1 1
62 10599 49.30 10 0 1
76 10604 18.00 10 0.1 1
2 10611 19.00 10 0 1
10 10609 31.00 10 0 1
62 10606 49.30 10 0.2 1
44 10624 19.45 10 0 1
23 10621 9.00 10 0 1
40 10535 18.40 10 0.1 1
69 10529 36.00 10 0 1
30 10534 25.89 10 0 1
40 10534 18.40 10 0.2 1
54 10534 7.45 10 0.2 1
60 10519 34.00 10 0.05 1

There are also 593 rows where there should only be 263.
In the outpu, the first row shold have an OrderID of 10609 and ProductID should be 1.
Go to Top of Page

snigrini
Starting Member

4 Posts

Posted - 2015-05-07 : 12:14:27
Hi James.

That does not give me the correct answer. The answer that it gives me is as follows:

ProductID OrderIDUnitPrice Discount Quantity
37 10259 20.80 1 0 1
19 10281 7.30 1 0 1
69 10308 28.80 1 0 1
13 10462 4.80 1 0 1
72 10538 34.80 1 0 1
59 10665 55.00 1 0 1
31 10782 12.50 1 0 1
40 10807 18.40 1 0 1
30 10917 25.89 1 0 1
4 11077 22.00 1 0 1
6 11077 25.00 1 0.02 1
7 11077 30.00 1 0.05 1
10 11077 31.00 1 0 1
14 11077 23.25 1 0.03 1
20 11077 81.00 1 0.04 1
32 11077 32.00 1 0 1
66 11077 17.00 1 0 1
73 11077 15.00 2 0.01 1
77 11077 13.00 2 0 1
52 11077 7.00 2 0 1
55 11077 24.00 2 0 1
60 11077 34.00 2 0.06 1
64 11077 33.25 2 0.03 1
39 11077 18.00 2 0.05 1
23 11077 9.00 2 0 1
16 11077 17.45 2 0.03 1
12 11077 38.00 2 0.05 1
8 11077 40.00 2 0.1 1
76 11075 18.00 2 0.15 1
52 11038 7.00 2 0 1
11 10926 21.00 2 0 1
53 10933 32.80 2 0 1
28 10952 45.60 2 0 1
60 10963 34.00 2 0.15 1
72 10992 34.80 2 0 1
1 11005 18.00 2 0 1
29 11006 123.79 2 0.25 1
68 11013 12.50 2 0 1
49 11019 20.00 2 0 1
65 10806 21.05 2 0 1
62 10798 49.30 2 0 1
38 10828 263.50 2 0 1
19 10831 9.20 2 0 1
77 10835 13.00 2 0.2 1
51 10870 53.00 2 0 1
39 10784 18.00 2 0.15 1
42 10767 14.00 2 0 1
31 10774 12.50 2 0.25 1
77 10735 13.00 2 0.1 1
10 10676 31.00 2 0 1
75 10634 7.75 2 0 1
46 10643 12.00 2 0.25 1
30 10652 25.89 2 0.25 1
40 10574 18.40 2 0 1
59 10531 55.00 2 0 1
10 10524 31.00 2 0 1
44 10469 15.50 2 0.15 1
55 10476 19.20 2 0.05 1
42 10309 11.20 2 0 1
71 10304 17.20 2 0 1
57 10282 15.60 2 0 1
51 10291 42.40 2 0.1 1
56 10262 30.40 2 0 1
40 10406 14.70 2 0.1 1
17 10415 31.20 2 0 1
46 10417 9.60 2 0.25 1
13 10420 4.80 2 0.1 1
26 10422 24.90 2 0 1
71 10447 17.20 2 0 1
31 10446 10.00 3 0.1 1
68 10288 10.00 3 0.1 1
72 10283 27.80 3 0 1
71 10309 17.20 3 0 1
68 10307 10.00 3 0 1
51 10484 42.40 3 0 1
43 10464 36.80 3 0 1
62 10505 49.30 3 0 1
28 10509 45.60 3 0 1
11 10528 21.00 3 0 1
35 10521 18.00 3 0 1
73 10558 15.00 3 0 1
51 10567 53.00 3 0 1
1 10609 18.00 3 0 1
24 10623 4.50 3 0 1
14 10625 23.25 3 0 1
16 10673 17.45 3 0 1
39 10661 18.00 3 0.2 1
14 10656 23.25 3 0.1 1
31 10730 12.50 3 0.05 1
2 10722 19.00 3 0 1
53 10712 32.80 3 0.05 1
30 10719 25.89 3 0.25 1
67 10775 14.00 3 0 1
54 10781 7.45 3 0.2 1
7 10790 30.00 3 0.15 1
54 10792 7.45 3 0 1
16 10738 17.45 3 0 1
69 10752 36.00 3 0 1
40 10754 18.40 3 0 1
35 10870 18.00 3 0 1
62 10861 49.30 3 0 1
53 10867 32.80 3 0 1
9 10848 97.00 3 0 1
51 10860 53.00 3 0 1
28 10873 45.60 3 0 1
70 10900 15.00 3 0.25 1
13 10832 6.00 3 0.2 1
64 10832 33.25 3 0 1
62 10822 49.30 3 0 1
46 11019 12.00 3 0 1
70 11057 15.00 3 0 1
21 11058 10.00 3 0 1
16 11066 17.45 3 0 1
41 11077 9.65 3 0 1
46 11077 12.00 3 0.02 1
3 11077 10.00 4 0 1
75 11077 7.75 4 0 1
30 11065 25.89 4 0.25 1
55 11064 24.00 4 0.1 1
60 11060 34.00 4 0 1
61 11058 28.50 4 0 1
13 11077 6.00 4 0 1
70 11037 15.00 4 0 1
61 11042 28.50 4 0 1
12 11049 38.00 4 0.2 1
7 11023 30.00 4 0 1
42 11013 14.00 4 0 1
1 11003 18.00 4 0 1
60 10995 34.00 4 0 1
41 10989 9.65 4 0 1
64 10968 33.25 4 0 1
18 10935 62.50 4 0.25 1
59 10947 55.00 4 0 1
55 10948 24.00 4 0 1
49 10804 20.00 4 0.15 1
1 10838 18.00 4 0.25 1
51 10843 53.00 4 0.25 1
70 10858 15.00 4 0 1
33 10850 2.50 4 0.15 1
35 10864 18.00 4 0 1
45 10753 9.50 4 0 1
13 10737 6.00 4 0 1
22 10768 21.00 4 0 1
52 10725 7.00 4 0 1
66 10682 17.00 4 0 1
41 10685 9.65 4 0 1
12 10695 38.00 4 0 1
32 10705 32.00 4 0 1
5 10708 21.35 4 0 1
55 10668 24.00 4 0.1 1
18 10644 62.50 4 0.1 1
54 10600 7.45 4 0 1
57 10582 19.50 4 0 1
52 10586 7.00 4 0.15 1
35 10589 18.00 4 0 1
76 10593 18.00 4 0.2 1
38 10541 263.50 4 0.1 1
59 10517 55.00 4 0 1
75 10460 6.20 4 0.25 1
28 10312 36.40 4 0 1
25 10323 11.20 4 0 1
39 10323 14.40 4 0 1
31 10325 10.00 4 0 1
68 10343 10.00 4 0.05 1
40 10347 14.70 4 0 1
35 10281 14.40 4 0 1
56 10295 30.40 4 0 1
72 10268 27.80 4 0 1
19 10421 7.30 4 0.15 1
29 10354 99.00 4 0 1
71 10364 17.20 5 0 1
65 10366 16.80 5 0 1
77 10366 10.40 5 0 1
21 10368 8.00 5 0.1 1
56 10426 30.40 5 0 1
36 10406 15.20 5 0.1 1
46 10436 9.60 5 0 1
72 10248 34.80 5 0 1
63 10293 35.10 5 0 1
67 10284 11.20 5 0.25 1
15 10323 12.40 5 0 1
62 10310 39.40 5 0 1
54 10306 5.90 5 0 1
70 10308 12.00 5 0 1
46 10466 9.60 5 0 1
11 10486 16.80 5 0 1
19 10487 7.30 5 0 1
77 10495 10.40 5 0 1
40 10498 18.40 5 0 1
24 10518 4.50 5 0 1
53 10520 32.80 5 0 1
57 10535 19.50 5 0.1 1
56 10596 38.00 5 0.2 1
26 10592 31.23 5 0.05 1
10 10568 31.00 5 0 1
77 10602 13.00 5 0.25 1
24 10620 4.50 5 0 1
52 10620 7.00 5 0 1
19 10621 9.20 5 0 1
39 10614 18.00 5 0 1
55 10615 24.00 5 0 1
42 10625 14.00 5 0 1
23 10674 9.00 5 0 1
36 10708 19.00 5 0 1
2 10703 19.00 5 0 1
1 10700 18.00 5 0.2 1
11 10726 21.00 5 0 1
61 10724 28.50 5 0 1
21 10716 10.00 5 0 1
19 10710 9.20 5 0 1
47 10710 9.50 5 0 1
38 10783 263.50 5 0 1
28 10740 45.60 5 0.2 1
74 10753 10.00 5 0 1
14 10750 23.25 5 0.15 1
2 10851 19.00 5 0.05 1
7 10858 30.00 5 0 1
13 10898 6.00 5 0 1
25 10887 14.00 5 0 1
43 10842 46.00 5 0 1
20 10828 81.00 5 0 1
62 10802 49.30 5 0.25 1
25 10810 14.00 5 0 1
70 10810 15.00 5 0 1
11 10944 21.00 5 0.25 1
38 10964 263.50 5 0 1
72 10958 34.80 5 0 1
4 10950 22.00 5 0 1
20 10927 81.00 5 0 1
52 10927 7.00 5 0 1
47 10928 9.50 5 0 1
76 10928 18.00 5 0 1
41 10909 9.65 5 0 1
61 10910 28.50 5 0 1
26 10973 31.23 5 0 1
56 11018 38.00 5 0 1
40 11038 18.40 5 0.2 1
61 11034 28.50 6 0 1
55 11001 24.00 6 0 1
26 11004 31.23 6 0 1
76 11004 18.00 6 0 1
41 10973 9.65 6 0 1
17 10972 39.00 6 0 1
44 10978 19.45 6 0.15 1
43 10987 46.00 6 0 1
16 10916 17.45 6 0 1
32 10916 32.00 6 0 1
75 10924 7.75 6 0 1
41 10951 9.65 6 0.05 1
7 10958 30.00 6 0 1
52 10961 7.00 6 0.05 1
18 10964 62.50 6 0 1
17 10949 39.00 6 0 1
70 10822 15.00 6 0 1
51 10821 53.00 6 0 1
54 10794 7.45 6 0.2 1
6 10830 25.00 6 0 1
35 10836 18.00 6 0 1
25 10840 14.00 6 0.2 1
13 10837 6.00 6 0 1
62 10902 49.30 6 0.15 1
17 10852 39.00 6 0 1
24 10866 4.50 6 0.25 1
68 10756 12.50 6 0.2 1
36 10739 19.00 6 0 1
13 10746 6.00 6 0 1
59 10749 55.00 6 0 1
10 10775 31.00 6 0 1
22 10763 21.00 6 0 1
55 10725 24.00 6 0 1
40 10728 18.40 6 0 1
3 10702 10.00 6 0 1
4 10704 22.00 6 0 1
9 10693 97.00 6 0 1
36 10687 19.00 6 0.25 1
42 10673 14.00 6 0 1
43 10673 46.00 6 0 1
47 10656 9.50 6 0.1 1
58 10636 13.25 6 0 1
54 10654 7.45 6 0.1 1
29 10624 123.79 6 0 1
48 10604 12.75 6 0.1 1
21 10609 10.00 6 0 1
1 10611 18.00 6 0 1
64 10574 33.25 6 0 1
63 10575 43.90 6 0 1
26 10587 31.23 6 0 1
57 10578 19.50 6 0 1
51 10537 53.00 6 0 1
41 10523 9.65 6 0.1 1
68 10521 12.50 6 0 1
70 10517 15.00 6 0 1
52 10517 7.00 6 0 1
49 10539 20.00 6 0 1
21 10550 10.00 6 0.1 1
31 10564 12.50 6 0.05 1
35 10553 18.00 6 0 1
53 10502 32.80 6 0 1
47 10512 9.50 6 0.15 1
42 10311 11.20 6 0 1
6 10325 20.00 6 0 1
76 10318 14.40 6 0 1
75 10347 6.20 6 0.15 1
32 10335 25.60 6 0.2 1
30 10282 20.70 6 0 1
24 10281 3.60 6 0 1
59 10275 44.00 6 0.05 1
75 10293 6.20 6 0 1
75 10294 6.20 6 0 1
22 10251 16.80 6 0.05 1
32 10258 25.60 6 0.2 1
39 10257 14.40 6 0 1
20 10272 64.80 6 0 1
64 10439 26.60 6 0 1
39 10445 14.40 6 0 1
11 10443 16.80 6 0.2 1
26 10448 24.90 6 0 1
54 10450 5.90 6 0.2 1
54 10408 5.90 6 0 1
11 10434 16.80 6 0 1
36 10371 15.20 6 0.2 1
71 10378 17.20 6 0 1
60 10380 27.20 6 0.1 1
28 10387 36.40 6 0 1
25 10393 11.20 7 0.25 1
77 10367 10.40 7 0 1
64 10426 26.60 7 0 1
72 10274 27.80 7 0 1
2 10335 15.20 7 0.2 1
69 10311 28.80 7 0 1
77 10491 10.40 7 0.15 1
28 10544 45.60 7 0 1
67 10544 14.00 7 0 1
70 10538 15.00 7 0 1
19 10676 9.20 7 0 1
19 10697 9.20 7 0.25 1
51 10716 53.00 7 0 1
75 10773 7.75 7 0.2 1
72 10745 34.80 7 0 1
59 10757 55.00 7 0 1
54 10800 7.45 7 0.1 1
43 10819 46.00 7 0 1
13 10810 6.00 7 0 1
19 10926 9.20 7 0 1
33 10972 2.50 7 0 1
61 10998 28.50 7 0 1
13 11036 6.00 7 0 1
18 11026 62.50 8 0 1
28 11068 45.60 8 0.15 1
2 11072 19.00 8 0 1
1 11006 18.00 8 0 1
37 10966 26.00 8 0 1
18 10985 62.50 8 0.1 1
23 10935 9.00 8 0.25 1
28 10937 45.60 8 0 1
7 10940 30.00 8 0 1
51 10956 53.00 8 0 1
64 10957 33.25 8 0 1
48 10814 12.75 8 0.15 1
29 10834 123.79 8 0.05 1
35 10831 18.00 8 0 1
38 10831 263.50 8 0 1
52 10862 7.00 8 0 1
39 10899 18.00 8 0.15 1
24 10883 4.50 8 0 1
1 10752 18.00 8 0 1
31 10747 12.50 8 0 1
52 10793 7.00 8 0 1
71 10720 21.50 8 0 1
17 10698 39.00 8 0.05 1
70 10698 15.00 8 0.05 1
59 10706 55.00 8 0 1
33 10677 2.50 8 0.15 1
31 10668 12.50 8 0.1 1
18 10639 62.50 8 0 1
75 10631 7.75 8 0.1 1
13 10613 6.00 8 0.1 1
21 10614 10.00 8 0 1
13 10539 6.00 8 0 1
24 10520 4.50 8 0 1
33 10528 2.50 8 0.2 1
1 10526 18.00 8 0.15 1
17 10550 39.00 8 0.1 1
28 10500 45.60 8 0.05 1
30 10468 20.70 8 0 1
64 10470 26.60 8 0 1
17 10319 31.20 8 0 1
52 10334 5.60 8 0 1
30 10329 20.70 8 0.05 1
33 10341 2.00 8 0 1
63 10278 35.10 8 0 1
70 10420 12.00 8 0.1 1
35 10444 14.40 8 0 1
41 10379 7.70 8 0.1 1
60 10357 27.20 8 0.2 1
69 10395 28.80 8 0 1
68 10385 10.00 8 0.2 1
18 10382 50.00 9 0 1
59 10411 44.00 9 0.2 1
64 10289 26.60 9 0 1
14 10249 18.60 9 0 1
59 10341 44.00 9 0.15 1
42 10345 11.20 9 0 1
59 10328 44.00 9 0 1
14 10325 18.60 9 0 1
46 10512 12.00 9 0.15 1
71 10541 21.50 9 0.1 1
72 10528 34.80 9 0 1
44 10518 19.45 9 0 1
73 10537 15.00 9 0 1
71 10598 21.50 9 0 1
41 10580 9.65 9 0.05 1
64 10629 33.25 9 0 1
35 10697 18.00 9 0.25 1
52 10683 7.00 9 0 1
62 10746 49.30 9 0 1
63 10747 43.90 9 0 1
43 10831 46.00 9 0 1
31 10833 12.50 9 0.1 1
53 10833 32.80 9 0.1 1
70 10824 15.00 9 0 1
69 10962 36.00 9 0 1
50 10948 16.25 9 0 1
43 10982 46.00 9 0 1
46 10969 12.00 9 0 1
60 11009 34.00 9 0 1
41 11067 9.65 9 0 1
2 11049 19.00 10 0.2 1
19 11076 9.20 10 0.25 1
2 11075 19.00 10 0.15 1
11 11073 21.00 10 0 1
13 11071 6.00 10 0.05 1
33 11054 2.50 10 0 1
77 11060 13.00 10 0 1
53 11062 32.80 10 0.2 1
51 11026 53.00 10 0 1
1 11025 18.00 10 0.1 1
1 11035 18.00 10 0 1
54 11035 7.45 10 0 1
24 11051 4.50 10 0.2 1
61 11052 28.50 10 0.2 1
11 11043 21.00 10 0 1
24 11010 4.50 10 0 1
23 11013 9.00 10 0 1
18 11018 62.50 10 0 1
29 11007 123.79 10 0 1
59 11005 55.00 10 0 1
40 11003 18.40 10 0 1
52 11003 7.00 10 0 1
75 10973 7.75 10 0 1
63 10974 43.90 10 0 1
75 10975 7.75 10 0 1
51 10977 53.00 10 0 1
40 10978 18.40 10 0 1
76 10986 18.00 10 0 1
31 10945 12.50 10 0 1
2 10939 19.00 10 0.15 1
69 10964 36.00 10 0 1
24 10960 4.50 10 0.25 1
72 10926 34.80 10 0 1
13 10926 6.00 10 0 1
42 10923 14.00 10 0.2 1
43 10923 46.00 10 0.2 1
60 10917 34.00 10 0 1
17 10915 39.00 10 0 1
54 10915 7.45 10 0 1
35 10921 18.00 10 0 1
1 10911 18.00 10 0 1
49 10910 20.00 10 0 1
2 10829 19.00 10 0 1
13 10829 6.00 10 0 1
25 10832 14.00 10 0.2 1
39 10840 18.00 10 0.2 1
51 10800 53.00 10 0.1 1
34 10805 14.00 10 0 1
38 10805 263.50 10 0 1
44 10796 19.45 10 0 1
72 10798 34.80 10 0 1
10 10874 31.00 10 0 1
65 10879 21.05 10 0 1
76 10879 18.00 10 0 1
73 10881 15.00 10 0 1
34 10890 14.00 10 0 1
24 10893 4.50 10 0 1
11 10869 21.00 10 0 1
55 10872 24.00 10 0.05 1
18 10853 62.50 10 0 1
25 10851 14.00 10 0.05 1
57 10851 19.50 10 0.05 1
27 10858 43.90 10 0 1
29 10857 123.79 10 0.25 1
76 10749 18.00 10 0 1
32 10759 32.00 10 0 1
2 10792 19.00 10 0 1
31 10783 12.50 10 0 1
10 10785 31.00 10 0 1
75 10785 7.75 10 0 1
41 10778 9.65 10 0 1
29 10687 123.79 10 0 1
8 10695 40.00 10 0 1
61 10716 28.50 10 0 1
60 10709 34.00 10 0 1
65 10730 21.05 10 0.05 1
56 10727 38.00 10 0.05 1
59 10727 55.00 10 0.05 1
60 10625 34.00 10 0 1
28 10624 45.60 10 0 1
11 10637 21.00 10 0 1
4 10635 22.00 10 0.1 1
16 10671 17.45 10 0 1
62 10671 49.30 10 0 1
53 10675 32.80 10 0 1
47 10657 9.50 10 0 1
76 10665 18.00 10 0 1
65 10666 21.05 10 0 1
68 10662 12.50 10 0 1
15 10579 15.50 10 0 1
29 10583 123.79 10 0 1
69 10583 36.00 10 0.15 1
7 10591 30.00 10 0 1
62 10574 49.30 10 0 1
76 10575 18.00 10 0 1
1 10576 18.00 10 0 1
39 10577 18.00 10 0 1
76 10566 18.00 10 0 1
32 10572 32.00 10 0.1 1
62 10599 49.30 10 0 1
76 10604 18.00 10 0.1 1
2 10611 19.00 10 0 1
10 10609 31.00 10 0 1
62 10606 49.30 10 0.2 1
44 10624 19.45 10 0 1
23 10621 9.00 10 0 1
40 10535 18.40 10 0.1 1
69 10529 36.00 10 0 1
30 10534 25.89 10 0 1
40 10534 18.40 10 0.2 1
54 10534 7.45 10 0.2 1
60 10519 34.00 10 0.05 1

There are also 593 rows where there should only be 263.
In the outpu, the first row shold have an OrderID of 10609 and ProductID should be 1.
Go to Top of Page

snigrini
Starting Member

4 Posts

Posted - 2015-05-07 : 12:14:27
Hi James.

That does not give me the correct answer. The answer that it gives me is as follows:

ProductID OrderIDUnitPrice Discount Quantity
37 10259 20.80 1 0 1
19 10281 7.30 1 0 1
69 10308 28.80 1 0 1
13 10462 4.80 1 0 1
72 10538 34.80 1 0 1
59 10665 55.00 1 0 1
31 10782 12.50 1 0 1
40 10807 18.40 1 0 1
30 10917 25.89 1 0 1
4 11077 22.00 1 0 1
6 11077 25.00 1 0.02 1
7 11077 30.00 1 0.05 1
10 11077 31.00 1 0 1
14 11077 23.25 1 0.03 1
20 11077 81.00 1 0.04 1
32 11077 32.00 1 0 1
66 11077 17.00 1 0 1
73 11077 15.00 2 0.01 1
77 11077 13.00 2 0 1
52 11077 7.00 2 0 1
55 11077 24.00 2 0 1
60 11077 34.00 2 0.06 1
64 11077 33.25 2 0.03 1
39 11077 18.00 2 0.05 1
23 11077 9.00 2 0 1
16 11077 17.45 2 0.03 1
12 11077 38.00 2 0.05 1
8 11077 40.00 2 0.1 1
76 11075 18.00 2 0.15 1
52 11038 7.00 2 0 1
11 10926 21.00 2 0 1
53 10933 32.80 2 0 1
28 10952 45.60 2 0 1
60 10963 34.00 2 0.15 1
72 10992 34.80 2 0 1
1 11005 18.00 2 0 1
29 11006 123.79 2 0.25 1
68 11013 12.50 2 0 1
49 11019 20.00 2 0 1
65 10806 21.05 2 0 1
62 10798 49.30 2 0 1
38 10828 263.50 2 0 1
19 10831 9.20 2 0 1
77 10835 13.00 2 0.2 1
51 10870 53.00 2 0 1
39 10784 18.00 2 0.15 1
42 10767 14.00 2 0 1
31 10774 12.50 2 0.25 1
77 10735 13.00 2 0.1 1
10 10676 31.00 2 0 1
75 10634 7.75 2 0 1
46 10643 12.00 2 0.25 1
30 10652 25.89 2 0.25 1
40 10574 18.40 2 0 1
59 10531 55.00 2 0 1
10 10524 31.00 2 0 1
44 10469 15.50 2 0.15 1
55 10476 19.20 2 0.05 1
42 10309 11.20 2 0 1
71 10304 17.20 2 0 1
57 10282 15.60 2 0 1
51 10291 42.40 2 0.1 1
56 10262 30.40 2 0 1
40 10406 14.70 2 0.1 1
17 10415 31.20 2 0 1
46 10417 9.60 2 0.25 1
13 10420 4.80 2 0.1 1
26 10422 24.90 2 0 1
71 10447 17.20 2 0 1
31 10446 10.00 3 0.1 1
68 10288 10.00 3 0.1 1
72 10283 27.80 3 0 1
71 10309 17.20 3 0 1
68 10307 10.00 3 0 1
51 10484 42.40 3 0 1
43 10464 36.80 3 0 1
62 10505 49.30 3 0 1
28 10509 45.60 3 0 1
11 10528 21.00 3 0 1
35 10521 18.00 3 0 1
73 10558 15.00 3 0 1
51 10567 53.00 3 0 1
1 10609 18.00 3 0 1
24 10623 4.50 3 0 1
14 10625 23.25 3 0 1
16 10673 17.45 3 0 1
39 10661 18.00 3 0.2 1
14 10656 23.25 3 0.1 1
31 10730 12.50 3 0.05 1
2 10722 19.00 3 0 1
53 10712 32.80 3 0.05 1
30 10719 25.89 3 0.25 1
67 10775 14.00 3 0 1
54 10781 7.45 3 0.2 1
7 10790 30.00 3 0.15 1
54 10792 7.45 3 0 1
16 10738 17.45 3 0 1
69 10752 36.00 3 0 1
40 10754 18.40 3 0 1
35 10870 18.00 3 0 1
62 10861 49.30 3 0 1
53 10867 32.80 3 0 1
9 10848 97.00 3 0 1
51 10860 53.00 3 0 1
28 10873 45.60 3 0 1
70 10900 15.00 3 0.25 1
13 10832 6.00 3 0.2 1
64 10832 33.25 3 0 1
62 10822 49.30 3 0 1
46 11019 12.00 3 0 1
70 11057 15.00 3 0 1
21 11058 10.00 3 0 1
16 11066 17.45 3 0 1
41 11077 9.65 3 0 1
46 11077 12.00 3 0.02 1
3 11077 10.00 4 0 1
75 11077 7.75 4 0 1
30 11065 25.89 4 0.25 1
55 11064 24.00 4 0.1 1
60 11060 34.00 4 0 1
61 11058 28.50 4 0 1
13 11077 6.00 4 0 1
70 11037 15.00 4 0 1
61 11042 28.50 4 0 1
12 11049 38.00 4 0.2 1
7 11023 30.00 4 0 1
42 11013 14.00 4 0 1
1 11003 18.00 4 0 1
60 10995 34.00 4 0 1
41 10989 9.65 4 0 1
64 10968 33.25 4 0 1
18 10935 62.50 4 0.25 1
59 10947 55.00 4 0 1
55 10948 24.00 4 0 1
49 10804 20.00 4 0.15 1
1 10838 18.00 4 0.25 1
51 10843 53.00 4 0.25 1
70 10858 15.00 4 0 1
33 10850 2.50 4 0.15 1
35 10864 18.00 4 0 1
45 10753 9.50 4 0 1
13 10737 6.00 4 0 1
22 10768 21.00 4 0 1
52 10725 7.00 4 0 1
66 10682 17.00 4 0 1
41 10685 9.65 4 0 1
12 10695 38.00 4 0 1
32 10705 32.00 4 0 1
5 10708 21.35 4 0 1
55 10668 24.00 4 0.1 1
18 10644 62.50 4 0.1 1
54 10600 7.45 4 0 1
57 10582 19.50 4 0 1
52 10586 7.00 4 0.15 1
35 10589 18.00 4 0 1
76 10593 18.00 4 0.2 1
38 10541 263.50 4 0.1 1
59 10517 55.00 4 0 1
75 10460 6.20 4 0.25 1
28 10312 36.40 4 0 1
25 10323 11.20 4 0 1
39 10323 14.40 4 0 1
31 10325 10.00 4 0 1
68 10343 10.00 4 0.05 1
40 10347 14.70 4 0 1
35 10281 14.40 4 0 1
56 10295 30.40 4 0 1
72 10268 27.80 4 0 1
19 10421 7.30 4 0.15 1
29 10354 99.00 4 0 1
71 10364 17.20 5 0 1
65 10366 16.80 5 0 1
77 10366 10.40 5 0 1
21 10368 8.00 5 0.1 1
56 10426 30.40 5 0 1
36 10406 15.20 5 0.1 1
46 10436 9.60 5 0 1
72 10248 34.80 5 0 1
63 10293 35.10 5 0 1
67 10284 11.20 5 0.25 1
15 10323 12.40 5 0 1
62 10310 39.40 5 0 1
54 10306 5.90 5 0 1
70 10308 12.00 5 0 1
46 10466 9.60 5 0 1
11 10486 16.80 5 0 1
19 10487 7.30 5 0 1
77 10495 10.40 5 0 1
40 10498 18.40 5 0 1
24 10518 4.50 5 0 1
53 10520 32.80 5 0 1
57 10535 19.50 5 0.1 1
56 10596 38.00 5 0.2 1
26 10592 31.23 5 0.05 1
10 10568 31.00 5 0 1
77 10602 13.00 5 0.25 1
24 10620 4.50 5 0 1
52 10620 7.00 5 0 1
19 10621 9.20 5 0 1
39 10614 18.00 5 0 1
55 10615 24.00 5 0 1
42 10625 14.00 5 0 1
23 10674 9.00 5 0 1
36 10708 19.00 5 0 1
2 10703 19.00 5 0 1
1 10700 18.00 5 0.2 1
11 10726 21.00 5 0 1
61 10724 28.50 5 0 1
21 10716 10.00 5 0 1
19 10710 9.20 5 0 1
47 10710 9.50 5 0 1
38 10783 263.50 5 0 1
28 10740 45.60 5 0.2 1
74 10753 10.00 5 0 1
14 10750 23.25 5 0.15 1
2 10851 19.00 5 0.05 1
7 10858 30.00 5 0 1
13 10898 6.00 5 0 1
25 10887 14.00 5 0 1
43 10842 46.00 5 0 1
20 10828 81.00 5 0 1
62 10802 49.30 5 0.25 1
25 10810 14.00 5 0 1
70 10810 15.00 5 0 1
11 10944 21.00 5 0.25 1
38 10964 263.50 5 0 1
72 10958 34.80 5 0 1
4 10950 22.00 5 0 1
20 10927 81.00 5 0 1
52 10927 7.00 5 0 1
47 10928 9.50 5 0 1
76 10928 18.00 5 0 1
41 10909 9.65 5 0 1
61 10910 28.50 5 0 1
26 10973 31.23 5 0 1
56 11018 38.00 5 0 1
40 11038 18.40 5 0.2 1
61 11034 28.50 6 0 1
55 11001 24.00 6 0 1
26 11004 31.23 6 0 1
76 11004 18.00 6 0 1
41 10973 9.65 6 0 1
17 10972 39.00 6 0 1
44 10978 19.45 6 0.15 1
43 10987 46.00 6 0 1
16 10916 17.45 6 0 1
32 10916 32.00 6 0 1
75 10924 7.75 6 0 1
41 10951 9.65 6 0.05 1
7 10958 30.00 6 0 1
52 10961 7.00 6 0.05 1
18 10964 62.50 6 0 1
17 10949 39.00 6 0 1
70 10822 15.00 6 0 1
51 10821 53.00 6 0 1
54 10794 7.45 6 0.2 1
6 10830 25.00 6 0 1
35 10836 18.00 6 0 1
25 10840 14.00 6 0.2 1
13 10837 6.00 6 0 1
62 10902 49.30 6 0.15 1
17 10852 39.00 6 0 1
24 10866 4.50 6 0.25 1
68 10756 12.50 6 0.2 1
36 10739 19.00 6 0 1
13 10746 6.00 6 0 1
59 10749 55.00 6 0 1
10 10775 31.00 6 0 1
22 10763 21.00 6 0 1
55 10725 24.00 6 0 1
40 10728 18.40 6 0 1
3 10702 10.00 6 0 1
4 10704 22.00 6 0 1
9 10693 97.00 6 0 1
36 10687 19.00 6 0.25 1
42 10673 14.00 6 0 1
43 10673 46.00 6 0 1
47 10656 9.50 6 0.1 1
58 10636 13.25 6 0 1
54 10654 7.45 6 0.1 1
29 10624 123.79 6 0 1
48 10604 12.75 6 0.1 1
21 10609 10.00 6 0 1
1 10611 18.00 6 0 1
64 10574 33.25 6 0 1
63 10575 43.90 6 0 1
26 10587 31.23 6 0 1
57 10578 19.50 6 0 1
51 10537 53.00 6 0 1
41 10523 9.65 6 0.1 1
68 10521 12.50 6 0 1
70 10517 15.00 6 0 1
52 10517 7.00 6 0 1
49 10539 20.00 6 0 1
21 10550 10.00 6 0.1 1
31 10564 12.50 6 0.05 1
35 10553 18.00 6 0 1
53 10502 32.80 6 0 1
47 10512 9.50 6 0.15 1
42 10311 11.20 6 0 1
6 10325 20.00 6 0 1
76 10318 14.40 6 0 1
75 10347 6.20 6 0.15 1
32 10335 25.60 6 0.2 1
30 10282 20.70 6 0 1
24 10281 3.60 6 0 1
59 10275 44.00 6 0.05 1
75 10293 6.20 6 0 1
75 10294 6.20 6 0 1
22 10251 16.80 6 0.05 1
32 10258 25.60 6 0.2 1
39 10257 14.40 6 0 1
20 10272 64.80 6 0 1
64 10439 26.60 6 0 1
39 10445 14.40 6 0 1
11 10443 16.80 6 0.2 1
26 10448 24.90 6 0 1
54 10450 5.90 6 0.2 1
54 10408 5.90 6 0 1
11 10434 16.80 6 0 1
36 10371 15.20 6 0.2 1
71 10378 17.20 6 0 1
60 10380 27.20 6 0.1 1
28 10387 36.40 6 0 1
25 10393 11.20 7 0.25 1
77 10367 10.40 7 0 1
64 10426 26.60 7 0 1
72 10274 27.80 7 0 1
2 10335 15.20 7 0.2 1
69 10311 28.80 7 0 1
77 10491 10.40 7 0.15 1
28 10544 45.60 7 0 1
67 10544 14.00 7 0 1
70 10538 15.00 7 0 1
19 10676 9.20 7 0 1
19 10697 9.20 7 0.25 1
51 10716 53.00 7 0 1
75 10773 7.75 7 0.2 1
72 10745 34.80 7 0 1
59 10757 55.00 7 0 1
54 10800 7.45 7 0.1 1
43 10819 46.00 7 0 1
13 10810 6.00 7 0 1
19 10926 9.20 7 0 1
33 10972 2.50 7 0 1
61 10998 28.50 7 0 1
13 11036 6.00 7 0 1
18 11026 62.50 8 0 1
28 11068 45.60 8 0.15 1
2 11072 19.00 8 0 1
1 11006 18.00 8 0 1
37 10966 26.00 8 0 1
18 10985 62.50 8 0.1 1
23 10935 9.00 8 0.25 1
28 10937 45.60 8 0 1
7 10940 30.00 8 0 1
51 10956 53.00 8 0 1
64 10957 33.25 8 0 1
48 10814 12.75 8 0.15 1
29 10834 123.79 8 0.05 1
35 10831 18.00 8 0 1
38 10831 263.50 8 0 1
52 10862 7.00 8 0 1
39 10899 18.00 8 0.15 1
24 10883 4.50 8 0 1
1 10752 18.00 8 0 1
31 10747 12.50 8 0 1
52 10793 7.00 8 0 1
71 10720 21.50 8 0 1
17 10698 39.00 8 0.05 1
70 10698 15.00 8 0.05 1
59 10706 55.00 8 0 1
33 10677 2.50 8 0.15 1
31 10668 12.50 8 0.1 1
18 10639 62.50 8 0 1
75 10631 7.75 8 0.1 1
13 10613 6.00 8 0.1 1
21 10614 10.00 8 0 1
13 10539 6.00 8 0 1
24 10520 4.50 8 0 1
33 10528 2.50 8 0.2 1
1 10526 18.00 8 0.15 1
17 10550 39.00 8 0.1 1
28 10500 45.60 8 0.05 1
30 10468 20.70 8 0 1
64 10470 26.60 8 0 1
17 10319 31.20 8 0 1
52 10334 5.60 8 0 1
30 10329 20.70 8 0.05 1
33 10341 2.00 8 0 1
63 10278 35.10 8 0 1
70 10420 12.00 8 0.1 1
35 10444 14.40 8 0 1
41 10379 7.70 8 0.1 1
60 10357 27.20 8 0.2 1
69 10395 28.80 8 0 1
68 10385 10.00 8 0.2 1
18 10382 50.00 9 0 1
59 10411 44.00 9 0.2 1
64 10289 26.60 9 0 1
14 10249 18.60 9 0 1
59 10341 44.00 9 0.15 1
42 10345 11.20 9 0 1
59 10328 44.00 9 0 1
14 10325 18.60 9 0 1
46 10512 12.00 9 0.15 1
71 10541 21.50 9 0.1 1
72 10528 34.80 9 0 1
44 10518 19.45 9 0 1
73 10537 15.00 9 0 1
71 10598 21.50 9 0 1
41 10580 9.65 9 0.05 1
64 10629 33.25 9 0 1
35 10697 18.00 9 0.25 1
52 10683 7.00 9 0 1
62 10746 49.30 9 0 1
63 10747 43.90 9 0 1
43 10831 46.00 9 0 1
31 10833 12.50 9 0.1 1
53 10833 32.80 9 0.1 1
70 10824 15.00 9 0 1
69 10962 36.00 9 0 1
50 10948 16.25 9 0 1
43 10982 46.00 9 0 1
46 10969 12.00 9 0 1
60 11009 34.00 9 0 1
41 11067 9.65 9 0 1
2 11049 19.00 10 0.2 1
19 11076 9.20 10 0.25 1
2 11075 19.00 10 0.15 1
11 11073 21.00 10 0 1
13 11071 6.00 10 0.05 1
33 11054 2.50 10 0 1
77 11060 13.00 10 0 1
53 11062 32.80 10 0.2 1
51 11026 53.00 10 0 1
1 11025 18.00 10 0.1 1
1 11035 18.00 10 0 1
54 11035 7.45 10 0 1
24 11051 4.50 10 0.2 1
61 11052 28.50 10 0.2 1
11 11043 21.00 10 0 1
24 11010 4.50 10 0 1
23 11013 9.00 10 0 1
18 11018 62.50 10 0 1
29 11007 123.79 10 0 1
59 11005 55.00 10 0 1
40 11003 18.40 10 0 1
52 11003 7.00 10 0 1
75 10973 7.75 10 0 1
63 10974 43.90 10 0 1
75 10975 7.75 10 0 1
51 10977 53.00 10 0 1
40 10978 18.40 10 0 1
76 10986 18.00 10 0 1
31 10945 12.50 10 0 1
2 10939 19.00 10 0.15 1
69 10964 36.00 10 0 1
24 10960 4.50 10 0.25 1
72 10926 34.80 10 0 1
13 10926 6.00 10 0 1
42 10923 14.00 10 0.2 1
43 10923 46.00 10 0.2 1
60 10917 34.00 10 0 1
17 10915 39.00 10 0 1
54 10915 7.45 10 0 1
35 10921 18.00 10 0 1
1 10911 18.00 10 0 1
49 10910 20.00 10 0 1
2 10829 19.00 10 0 1
13 10829 6.00 10 0 1
25 10832 14.00 10 0.2 1
39 10840 18.00 10 0.2 1
51 10800 53.00 10 0.1 1
34 10805 14.00 10 0 1
38 10805 263.50 10 0 1
44 10796 19.45 10 0 1
72 10798 34.80 10 0 1
10 10874 31.00 10 0 1
65 10879 21.05 10 0 1
76 10879 18.00 10 0 1
73 10881 15.00 10 0 1
34 10890 14.00 10 0 1
24 10893 4.50 10 0 1
11 10869 21.00 10 0 1
55 10872 24.00 10 0.05 1
18 10853 62.50 10 0 1
25 10851 14.00 10 0.05 1
57 10851 19.50 10 0.05 1
27 10858 43.90 10 0 1
29 10857 123.79 10 0.25 1
76 10749 18.00 10 0 1
32 10759 32.00 10 0 1
2 10792 19.00 10 0 1
31 10783 12.50 10 0 1
10 10785 31.00 10 0 1
75 10785 7.75 10 0 1
41 10778 9.65 10 0 1
29 10687 123.79 10 0 1
8 10695 40.00 10 0 1
61 10716 28.50 10 0 1
60 10709 34.00 10 0 1
65 10730 21.05 10 0.05 1
56 10727 38.00 10 0.05 1
59 10727 55.00 10 0.05 1
60 10625 34.00 10 0 1
28 10624 45.60 10 0 1
11 10637 21.00 10 0 1
4 10635 22.00 10 0.1 1
16 10671 17.45 10 0 1
62 10671 49.30 10 0 1
53 10675 32.80 10 0 1
47 10657 9.50 10 0 1
76 10665 18.00 10 0 1
65 10666 21.05 10 0 1
68 10662 12.50 10 0 1
15 10579 15.50 10 0 1
29 10583 123.79 10 0 1
69 10583 36.00 10 0.15 1
7 10591 30.00 10 0 1
62 10574 49.30 10 0 1
76 10575 18.00 10 0 1
1 10576 18.00 10 0 1
39 10577 18.00 10 0 1
76 10566 18.00 10 0 1
32 10572 32.00 10 0.1 1
62 10599 49.30 10 0 1
76 10604 18.00 10 0.1 1
2 10611 19.00 10 0 1
10 10609 31.00 10 0 1
62 10606 49.30 10 0.2 1
44 10624 19.45 10 0 1
23 10621 9.00 10 0 1
40 10535 18.40 10 0.1 1
69 10529 36.00 10 0 1
30 10534 25.89 10 0 1
40 10534 18.40 10 0.2 1
54 10534 7.45 10 0.2 1
60 10519 34.00 10 0.05 1

There are also 593 rows where there should only be 263.
In the outpu, the first row shold have an OrderID of 10609 and ProductID should be 1.
Go to Top of Page
   

- Advertisement -