Sql |
SELECT distinct a.style_id,
case a.style_id
when 118564 then 1
when 227609 then 2
when 253479 then 3
when 40358 then 4
when 273822 then 5
when 24064 then 6
when 213496 then 7
when 51481 then 8
when 287718 then 9
when 188448 then 10
when 248111 then 11
when 133164 then 12
when 223080 then 13
when 101930 then 14
when 51486 then 15
when 220932 then 16
when 326369 then 17
when 214587 then 18
when 283310 then 19
when 115351 then 20
when 279837 then 21
when 253191 then 22
when 173188 then 23
when 145075 then 24
when 211446 then 25
when 300603 then 26
when 141454 then 27
when 48887 then 28
when 40263 then 29
when 214586 then 30
when 291845 then 31
when 252720 then 32
when 202366 then 33
when 197692 then 34
when 278597 then 35
when 24760 then 36
when 203247 then 37
when 262597 then 38
when 286757 then 39
when 40262 then 40
when 202482 then 41
when 264833 then 42
when 255014 then 43
when 205461 then 44
when 261531 then 45
when 272095 then 46
when 23450 then 47
when 144010 then 48
when 185556 then 49
when 147471 then 50
when 326171 then 51
when 192981 then 52
when 326833 then 53
when 278329 then 54
when 279925 then 55
when 324545 then 56
when 40332 then 57
when 264770 then 58
when 266826 then 59
when 165252 then 60
when 195457 then 61
when 104216 then 62
when 263244 then 63
when 264849 then 64
when 40264 then 65
when 195458 then 66
when 227668 then 67
when 260975 then 68
when 260590 then 69
when 268570 then 70
when 268561 then 71
when 283858 then 72
when 36024 then 73
when 247211 then 74
when 247212 then 75
when 247210 then 76
when 263647 then 77
when 262593 then 78
when 61814 then 79
when 253192 then 80
when 253193 then 81
when 264205 then 82
when 272084 then 83
when 40301 then 84
when 40336 then 85
when 193178 then 86
when 253157 then 87
when 253159 then 88
when 253156 then 89
when 260634 then 90
when 291864 then 91
when 40274 then 92
when 188740 then 93
when 272532 then 94
when 272136 then 95
when 272085 then 96
when 272094 then 97
when 272086 then 98
when 282678 then 99
when 284422 then 100
when 319739 then 101
when 319740 then 102
when 105627 then 103
when 247206 then 104
when 263414 then 105
when 264203 then 106
when 209922 then 107
when 260637 then 108
when 260636 then 109
when 272093 then 110
when 272644 then 111
when 190031 then 112
when 266769 then 113
when 285027 then 114
when 48886 then 115
when 19093 then 116
when 193472 then 117
when 40369 then 118
when 268636 then 119
when 277726 then 120
when 277729 then 121
when 117575 then 122
when 143333 then 123
when 61804 then 124
when 61805 then 125
when 48884 then 126
when 227669 then 127
when 172340 then 128
when 172338 then 129
when 261957 then 130
when 281487 then 131
when 277039 then 132
when 48883 then 133
when 246578 then 134
when 277409 then 135
when 277727 then 136
when 277728 then 137
when 277730 then 138
when 40326 then 139
when 323821 then 140
when 172342 then 141
when 220936 then 142
when 262127 then 143
when 252723 then 144
when 252721 then 145
when 289268 then 146
when 277408 then 147
when 281157 then 148
when 198959 then 149
when 247488 then 150
when 329333 then 151
when 202670 then 152
when 202671 then 153
when 267834 then 154
when 283325 then 155
when 326847 then 156
when 264831 then 157
when 225308 then 158
when 78192 then 159
when 281630 then 160
when 283281 then 161
when 285532 then 162
when 287957 then 163
when 136218 then 164
when 51499 then 165
when 103825 then 166
when 268016 then 167
when 148973 then 168
when 123645 then 169
when 283220 then 170
when 317904 then 171
when 215946 then 172
when 51494 then 173
when 136214 then 174
when 36605 then 175
when 222706 then 176
when 40384 then 177
when 301920 then 178
when 301922 then 179
when 324225 then 180
when 64010 then 181
when 283371 then 182
when 283232 then 183
when 40331 then 184
when 51502 then 185
when 264207 then 186
when 283257 then 187
when 283389 then 188
when 204278 then 189
when 294627 then 190
when 185560 then 191
when 195906 then 192
when 94198 then 193
when 173212 then 194
when 191514 then 195
when 117774 then 196
when 283323 then 197
when 283329 then 198
when 283372 then 199
when 293281 then 200
when 296453 then 201
when 303754 then 202
when 40320 then 203
when 215817 then 204
when 323311 then 205
when 51496 then 206
when 76572 then 207
when 51493 then 208
when 247500 then 209
when 79854 then 210
when 103815 then 211
when 266218 then 212
when 40377 then 213
when 40359 then 214
when 40328 then 215
when 301269 then 216
when 51500 then 217
when 317905 then 218
when 181143 then 219
when 204018 then 220
when 51501 then 221
when 283213 then 222
when 181460 then 223
when 136213 then 224
when 269073 then 225
when 192050 then 226
when 217505 then 227
when 283379 then 228
when 40329 then 229
when 255249 then 230
when 282567 then 231
when 326624 then 232
when 101928 then 233
when 300928 then 234
when 48898 then 235
when 266383 then 236
when 74004 then 237
when 279003 then 238
when 61878 then 239
when 329455 then 240
when 101929 then 241
when 277693 then 242
when 193838 then 243
when 249030 then 244
when 304310 then 245
when 101931 then 246
when 172343 then 247
when 51483 then 248
when 51482 then 249
when 285530 then 250
when 325880 then 251
when 61968 then 252
when 199494 then 253
when 252431 then 254
when 145797 then 255
when 227610 then 256
when 134500 then 257
when 262599 then 258
when 264968 then 259
when 209503 then 260
when 61381 then 261
when 190030 then 262
when 262135 then 263
when 61951 then 264
when 38018 then 265
when 281318 then 266
when 199043 then 267
when 176261 then 268
when 199045 then 269
when 249033 then 270
when 264572 then 271
when 285534 then 272
when 309642 then 273
when 55798 then 274
when 212813 then 275
when 264974 then 276
when 36607 then 277
when 325885 then 278
when 278126 then 279
when 297235 then 280
when 247098 then 281
when 199044 then 282
when 46372 then 283
when 112285 then 284
when 329451 then 285
when 51485 then 286
when 34595 then 287
when 118213 then 288
when 284324 then 289
when 323310 then 290
when 278128 then 291
when 228175 then 292
when 48885 then 293
when 277404 then 294
when 262084 then 295
when 264969 then 296
when 270142 then 297
when 278596 then 298
when 52133 then 299
when 248017 then 300
when 212023 then 301
when 212823 then 302
when 223181 then 303
when 188447 then 304
when 302056 then 305
when 326207 then 306
when 309514 then 307
when 131899 then 308
when 33122 then 309
when 191956 then 310
when 300460 then 311
when 110158 then 312
when 123646 then 313
when 144547 then 314
when 247778 then 315
when 247767 then 316
when 289833 then 317
when 323229 then 318
when 329464 then 319
when 214820 then 320
when 212089 then 321
when 212024 then 322
when 262601 then 323
when 247209 then 324
when 298407 then 325
when 298408 then 326
when 298409 then 327
when 188340 then 328
when 207007 then 329
when 115864 then 330
when 193195 then 331
when 51479 then 332
when 254110 then 333
when 289698 then 334
when 206475 then 335
when 251674 then 336
when 131903 then 337
when 70520 then 338
when 204534 then 339
when 270861 then 340
when 311478 then 341
when 311486 then 342
when 281593 then 343
when 281594 then 344
when 192182 then 345
when 170670 then 346
when 217314 then 347
when 261494 then 348
when 192324 then 349
when 116595 then 350
when 302584 then 351
when 225829 then 352
when 131896 then 353
when 276663 then 354
when 170534 then 355
when 145772 then 356
when 200030 then 357
when 227150 then 358
when 242384 then 359
when 326367 then 360
when 317969 then 361
when 264676 then 362
when 152571 then 363
when 44697 then 364
when 154855 then 365
when 168601 then 366
when 175816 then 367
when 115945 then 368
when 182319 then 369
when 263639 then 370
when 288383 then 371
when 15188 then 372
when 331046 then 373
when 188446 then 374
when 277787 then 375
when 99105 then 376
when 53629 then 377
when 66939 then 378
when 269950 then 379
when 276662 then 380
when 311454 then 381
when 115822 then 382
when 142925 then 383
when 172664 then 384
when 202078 then 385
when 209695 then 386
when 212144 then 387
when 210934 then 388
when 254183 then 389
when 170184 then 390
when 10152 then 391
when 133629 then 392
when 192829 then 393
when 225327 then 394
when 131287 then 395
when 242377 then 396
when 40312 then 397
when 216378 then 398
when 279977 then 399
when 326178 then 400
when 276021 then 401
when 287332 then 402
when 287331 then 403
when 165137 then 404
when 138675 then 405
when 143739 then 406
when 116832 then 407
when 163876 then 408
when 108816 then 409
when 191324 then 410
when 202913 then 411
when 216854 then 412
when 263638 then 413
when 252123 then 414
when 215776 then 415
when 55480 then 416
when 264840 then 417
when 112065 then 418
when 223108 then 419
when 15753 then 420
when 134114 then 421
when 44696 then 422
when 153026 then 423
when 322326 then 424
when 225841 then 425
when 221027 then 426
when 166566 then 427
when 261810 then 428
when 267685 then 429
when 268579 then 430
when 268587 then 431
when 268569 then 432
when 268559 then 433
when 268553 then 434
when 268550 then 435
when 268546 then 436
when 268545 then 437
when 268538 then 438
when 296372 then 439
when 304938 then 440
when 298406 then 441
when 36047 then 442
when 24761 then 443
when 215345 then 444
when 279454 then 445
when 136027 then 446
when 44688 then 447
when 196026 then 448
when 48904 then 449
when 311102 then 450
when 264857 then 451
when 271323 then 452
when 271324 then 453
when 169360 then 454
when 169359 then 455
when 120379 then 456
when 158037 then 457
when 302999 then 458
when 61812 then 459
when 275754 then 460
when 192469 then 461
when 210595 then 462
when 131095 then 463
when 123628 then 464
when 222650 then 465
when 116993 then 466
when 94317 then 467
when 266384 then 468
when 281084 then 469
when 298825 then 470
when 288507 then 471
when 326747 then 472
when 326745 then 473
when 147375 then 474
when 147380 then 475
when 116776 then 476
when 64669 then 477
when 197406 then 478
when 191646 then 479
when 208087 then 480
when 228174 then 481
when 252688 then 482
when 253472 then 483
when 264420 then 484
when 266288 then 485
when 323336 then 486
when 270031 then 487
when 251949 then 488
when 169363 then 489
when 206920 then 490
when 115349 then 491
when 114238 then 492
when 110026 then 493
when 227241 then 494
when 268591 then 495
when 268576 then 496
when 277680 then 497
when 291860 then 498
when 294688 then 499
when 307740 then 500
when 322558 then 501
when 53615 then 502
when 158172 then 503
when 61808 then 504
when 61810 then 505
when 278987 then 506
when 12879 then 507
when 173263 then 508
when 201372 then 509
when 249867 then 510
when 256192 then 511
when 322429 then 512
when 300881 then 513
when 181868 then 514
when 48828 then 515
when 48855 then 516
when 6968 then 517
when 274645 then 518
when 274644 then 519
when 291742 then 520
when 277407 then 521
when 254712 then 522
when 110337 then 523
when 302997 then 524
when 302998 then 525
when 136716 then 526
when 129957 then 527
when 51478 then 528
when 261806 then 529
when 312197 then 530
when 322532 then 531
when 251934 then 532
when 298681 then 533
when 148130 then 534
when 148132 then 535
when 272921 then 536
when 133442 then 537
when 203599 then 538
when 48920 then 539
when 263381 then 540
when 261532 then 541
when 28052 then 542
when 296494 then 543
when 154946 then 544
when 245723 then 545
when 254711 then 546
when 260776 then 547
when 192500 then 548
when 296878 then 549
when 120718 then 550
when 247208 then 551
when 263398 then 552
when 324737 then 553
when 135828 then 554
when 248058 then 555
when 307449 then 556
when 247776 then 557
when 285802 then 558
when 204787 then 559
when 214582 then 560
when 245695 then 561
when 279838 then 562
when 202116 then 563
when 188743 then 564
when 273794 then 565
when 61809 then 566
when 61807 then 567
when 278989 then 568
when 262129 then 569
when 262122 then 570
when 262124 then 571
when 89338 then 572
when 75425 then 573
when 192348 then 574
when 22131 then 575
when 261885 then 576
when 154718 then 577
when 301808 then 578
when 70207 then 579
when 284646 then 580
when 225840 then 581
when 303631 then 582
when 289365 then 583
when 298071 then 584
when 173192 then 585
when 261808 then 586
when 279006 then 587
when 283265 then 588
when 263399 then 589
when 289828 then 590
when 303608 then 591
when 319964 then 592
when 12705 then 593
when 134630 then 594
when 22917 then 595
when 53956 then 596
when 215344 then 597
when 215102 then 598
when 267617 then 599
when 277397 then 600
when 310842 then 601
when 323704 then 602
when 328991 then 603
when 266397 then 604
when 272920 then 605
when 204210 then 606
when 261498 then 607
when 276825 then 608
when 303264 then 609
when 264644 then 610
when 256638 then 611
when 10992 then 612
when 202825 then 613
when 172324 then 614
when 192181 then 615
when 88931 then 616
when 267822 then 617
when 289119 then 618
when 12666 then 619
when 212280 then 620
when 214268 then 621
when 245694 then 622
when 277406 then 623
when 277410 then 624
when 172841 then 625
when 61377 then 626
when 113117 then 627
when 132650 then 628
when 101950 then 629
when 223170 then 630
when 202674 then 631
when 202673 then 632
when 202679 then 633
when 202672 then 634
when 202704 then 635
when 168787 then 636
when 168784 then 637
when 312305 then 638
when 181144 then 639
when 189105 then 640
when 48879 then 641
when 301271 then 642
when 75311 then 643
when 278419 then 644
when 289081 then 645
when 291871 then 646
when 293040 then 647
when 149785 then 648
when 193837 then 649
when 203703 then 650
when 214426 then 651
when 112563 then 652
when 130470 then 653
when 245438 then 654
when 225775 then 655
when 100426 then 656
when 115235 then 657
when 203895 then 658
when 48794 then 659
when 203891 then 660
when 130314 then 661
when 322661 then 662
when 266212 then 663
when 294675 then 664
when 294887 then 665
when 304720 then 666
when 269232 then 667
when 278430 then 668
when 283322 then 669
when 285244 then 670
when 205219 then 671
when 245236 then 672
when 256579 then 673
when 260502 then 674
when 277405 then 675
when 212098 then 676
when 249003 then 677
when 269126 then 678
when 323277 then 679
when 172950 then 680
when 252610 then 681
when 276811 then 682
when 291366 then 683
when 288973 then 684
when 323328 then 685
when 267809 then 686
when 289122 then 687
when 299171 then 688
when 304942 then 689
when 255425 then 690
when 264970 then 691
when 278253 then 692
when 61382 then 693
when 88295 then 694
when 88286 then 695
when 132652 then 696
when 168783 then 697
when 61929 then 698
when 202676 then 699
when 202677 then 700
when 202678 then 701
when 223171 then 702
when 202675 then 703
when 75326 then 704
when 103481 then 705
when 75334 then 706
when 217507 then 707
when 217508 then 708
when 195907 then 709
when 217506 then 710
when 251269 then 711
when 320398 then 712
when 159077 then 713
when 161357 then 714
when 197700 then 715
when 195599 then 716
when 218442 then 717
when 210669 then 718
when 267463 then 719
when 284994 then 720
when 276817 then 721
when 307417 then 722
when 306714 then 723
when 326221 then 724
when 326162 then 725
when 326319 then 726
when 321307 then 727
when 251944 then 728
when 145264 then 729
when 11788 then 730
when 173153 then 731
when 75612 then 732
when 267654 then 733
when 283227 then 734
when 286210 then 735
when 290621 then 736
when 299150 then 737
when 299149 then 738
when 305126 then 739
when 326829 then 740
when 327105 then 741
when 330333 then 742
when 58507 then 743
when 58508 then 744
when 119052 then 745
when 277403 then 746
when 284192 then 747
when 291813 then 748
when 58492 then 749
when 261807 then 750
when 289693 then 751
when 322473 then 752
when 133828 then 753
when 242402 then 754
when 268318 then 755
when 294890 then 756
when 300612 then 757
when 305649 then 758
when 311616 then 759
when 154640 then 760
when 24217 then 761
when 192506 then 762
when 218343 then 763
when 264089 then 764
when 134481 then 765
when 277970 then 766
when 303946 then 767
when 326743 then 768
when 331032 then 769
when 305040 then 770
when 172483 then 771
when 170100 then 772
when 248994 then 773
when 249045 then 774
when 251570 then 775
when 252397 then 776
when 263632 then 777
when 210670 then 778
when 272159 then 779
when 287446 then 780
when 276916 then 781
when 297428 then 782
when 307231 then 783
when 323396 then 784
when 329182 then 785
when 150758 then 786
when 330776 then 787
when 268281 then 788
when 268241 then 789
when 280167 then 790
when 289095 then 791
when 290706 then 792
when 291700 then 793
when 298799 then 794
when 301138 then 795
when 61944 then 796
when 214583 then 797
when 219799 then 798
when 220447 then 799
when 220446 then 800
when 144632 then 801
when 73880 then 802
when 284191 then 803
when 296153 then 804
when 320399 then 805
when 133830 then 806
when 1179 then 807
when 251525 then 808
when 251943 then 809
when 262963 then 810
when 262979 then 811
when 262974 then 812
when 262486 then 813
when 22111 then 814
when 22124 then 815
when 276974 then 816
when 284344 then 817
when 277802 then 818
when 304876 then 819
when 304875 then 820
when 326129 then 821
when 220958 then 822
when 282148 then 823
when 291747 then 824
when 291746 then 825
when 293061 then 826
when 293058 then 827
when 298795 then 828
when 323993 then 829
when 262922 then 830
when 303609 then 831
when 251569 then 832
when 262804 then 833
when 195509 then 834
when 264112 then 835
when 263397 then 836
when 280968 then 837
when 289186 then 838
when 289600 then 839
when 276813 then 840
when 286992 then 841
when 297221 then 842
when 303618 then 843
when 175980 then 844
when 328976 then 845
when 329269 then 846
when 204909 then 847
when 209601 then 848
when 251942 then 849
when 248793 then 850
when 251918 then 851
when 225787 then 852
when 225790 then 853
when 254583 then 854
when 312335 then 855
when 304879 then 856
when 329433 then 857
when 326882 then 858
when 330989 then 859
when 330959 then 860
when 331043 then 861
when 331034 then 862
when 331053 then 863
when 331048 then 864
when 109120 then 865
when 217499 then 866
when 207557 then 867
when 75328 then 868
when 217501 then 869
when 36622 then 870
when 223177 then 871
when 252482 then 872
when 252835 then 873
when 262113 then 874
when 143454 then 875
when 103957 then 876
when 248900 then 877
when 288157 then 878
when 293062 then 879
when 298804 then 880
when 298926 then 881
when 305052 then 882
when 322598 then 883
when 322474 then 884
when 326807 then 885
when 169896 then 886
when 192359 then 887
when 320395 then 888
when 144859 then 889
when 147482 then 890
when 22099 then 891
when 147060 then 892
when 62189 then 893
when 123901 then 894
when 275840 then 895
when 279441 then 896
when 283981 then 897
when 304461 then 898
when 312336 then 899
when 304877 then 900
when 324485 then 901
when 328610 then 902
when 329952 then 903
when 331025 then 904
when 331022 then 905
when 161632 then 906
when 249639 then 907
when 249321 then 908
when 268153 then 909
when 268984 then 910
when 284748 then 911
when 287528 then 912
when 287522 then 913
when 286991 then 914
when 296572 then 915
when 316372 then 916
when 306785 then 917
when 326254 then 918
when 140058 then 919
when 7688 then 920
when 114201 then 921
when 263620 then 922
when 42175 then 923
when 147161 then 924
when 273407 then 925
when 278662 then 926
when 280403 then 927
when 144630 then 928
when 323790 then 929
when 323787 then 930
when 24191 then 931
when 267703 then 932
when 267657 then 933
when 277897 then 934
when 288138 then 935
when 294866 then 936
when 80476 then 937
when 57208 then 938
when 218348 then 939
when 108813 then 940
when 23961 then 941
when 251931 then 942
when 225806 then 943
when 225807 then 944
when 251930 then 945
when 278758 then 946
when 24160 then 947
when 284331 then 948
when 288213 then 949
when 296664 then 950
when 24214 then 951
when 323180 then 952
when 323610 then 953
when 326741 then 954
when 330985 then 955
when 331003 then 956
when 331052 then 957
when 264483 then 958
when 262977 then 959
when 264457 then 960
when 270909 then 961
when 279061 then 962
when 278759 then 963
when 278761 then 964
when 284328 then 965
when 22117 then 966
when 22118 then 967
when 305021 then 968
when 304874 then 969
when 318989 then 970
when 287866 then 971
when 310621 then 972
when 330982 then 973
when 330988 then 974
when 330963 then 975
when 330969 then 976
when 331033 then 977
when 330978 then 978
when 330952 then 979
when 331038 then 980
when 331042 then 981
when 196538 then 982
when 203917 then 983
when 207852 then 984
when 227302 then 985
when 220596 then 986
when 252085 then 987
when 252300 then 988
when 252228 then 989
when 260769 then 990
when 263782 then 991
when 287516 then 992
when 304306 then 993
when 307906 then 994
when 306875 then 995
when 310128 then 996
when 316371 then 997
when 322658 then 998
when 326324 then 999
when 329111 then 1000
else 1000
end as ranking,
max(a.non_invt) as non_invt,sum(qoh + qc) as available,max(a.dept) as dept,max(a.brand) as brand,max(a.of3) as of3,case when sum(qoh + qc) > 0 then 1 else 0 end as instock
FROM web_all_products a WITH (NOLOCK)
INNER JOIN dbo.tb_skus b WITH (NOLOCK) ON (a.style_id = b.style_id)
INNER JOIN dbo.tb_sku_buckets c WITH (NOLOCK) ON (b.sku_id = c.sku_id and c.store_id in (10,32))
INNER JOIN dbo.tb_styles_web_taxonomy d WITH (NOLOCK) ON (a.style_id = d.style)
INNER JOIN dbo.tb_styles qq WITH (NOLOCK) ON (qq.style_id = a.style_id)
where a.style_id in (118564,227609,253479,40358,273822,24064,213496,51481,287718,188448,248111,133164,223080,101930,51486,220932,326369,214587,283310,115351,279837,253191,173188,145075,211446,300603,141454,48887,40263,214586,291845,252720,202366,197692,278597,24760,203247,262597,286757,40262,202482,264833,255014,205461,261531,272095,23450,144010,185556,147471,326171,192981,326833,278329,279925,324545,40332,264770,266826,165252,195457,104216,263244,264849,40264,195458,227668,260975,260590,268570,268561,283858,36024,247211,247212,247210,263647,262593,61814,253192,253193,264205,272084,40301,40336,193178,253157,253159,253156,260634,291864,40274,188740,272532,272136,272085,272094,272086,282678,284422,319739,319740,105627,247206,263414,264203,209922,260637,260636,272093,272644,190031,266769,285027,48886,19093,193472,40369,268636,277726,277729,117575,143333,61804,61805,48884,227669,172340,172338,261957,281487,277039,48883,246578,277409,277727,277728,277730,40326,323821,172342,220936,262127,252723,252721,289268,277408,281157,198959,247488,329333,202670,202671,267834,283325,326847,264831,225308,78192,281630,283281,285532,287957,136218,51499,103825,268016,148973,123645,283220,317904,215946,51494,136214,36605,222706,40384,301920,301922,324225,64010,283371,283232,40331,51502,264207,283257,283389,204278,294627,185560,195906,94198,173212,191514,117774,283323,283329,283372,293281,296453,303754,40320,215817,323311,51496,76572,51493,247500,79854,103815,266218,40377,40359,40328,301269,51500,317905,181143,204018,51501,283213,181460,136213,269073,192050,217505,283379,40329,255249,282567,326624,101928,300928,48898,266383,74004,279003,61878,329455,101929,277693,193838,249030,304310,101931,172343,51483,51482,285530,325880,61968,199494,252431,145797,227610,134500,262599,264968,209503,61381,190030,262135,61951,38018,281318,199043,176261,199045,249033,264572,285534,309642,55798,212813,264974,36607,325885,278126,297235,247098,199044,46372,112285,329451,51485,34595,118213,284324,323310,278128,228175,48885,277404,262084,264969,270142,278596,52133,248017,212023,212823,223181,188447,302056,326207,309514,131899,33122,191956,300460,110158,123646,144547,247778,247767,289833,323229,329464,214820,212089,212024,262601,247209,298407,298408,298409,188340,207007,115864,193195,51479,254110,289698,206475,251674,131903,70520,204534,270861,311478,311486,281593,281594,192182,170670,217314,261494,192324,116595,302584,225829,131896,276663,170534,145772,200030,227150,242384,326367,317969,264676,152571,44697,154855,168601,175816,115945,182319,263639,288383,15188,331046,188446,277787,99105,53629,66939,269950,276662,311454,115822,142925,172664,202078,209695,212144,210934,254183,170184,10152,133629,192829,225327,131287,242377,40312,216378,279977,326178,276021,287332,287331,165137,138675,143739,116832,163876,108816,191324,202913,216854,263638,252123,215776,55480,264840,112065,223108,15753,134114,44696,153026,322326,225841,221027,166566,261810,267685,268579,268587,268569,268559,268553,268550,268546,268545,268538,296372,304938,298406,36047,24761,215345,279454,136027,44688,196026,48904,311102,264857,271323,271324,169360,169359,120379,158037,302999,61812,275754,192469,210595,131095,123628,222650,116993,94317,266384,281084,298825,288507,326747,326745,147375,147380,116776,64669,197406,191646,208087,228174,252688,253472,264420,266288,323336,270031,251949,169363,206920,115349,114238,110026,227241,268591,268576,277680,291860,294688,307740,322558,53615,158172,61808,61810,278987,12879,173263,201372,249867,256192,322429,300881,181868,48828,48855,6968,274645,274644,291742,277407,254712,110337,302997,302998,136716,129957,51478,261806,312197,322532,251934,298681,148130,148132,272921,133442,203599,48920,263381,261532,28052,296494,154946,245723,254711,260776,192500,296878,120718,247208,263398,324737,135828,248058,307449,247776,285802,204787,214582,245695,279838,202116,188743,273794,61809,61807,278989,262129,262122,262124,89338,75425,192348,22131,261885,154718,301808,70207,284646,225840,303631,289365,298071,173192,261808,279006,283265,263399,289828,303608,319964,12705,134630,22917,53956,215344,215102,267617,277397,310842,323704,328991,266397,272920,204210,261498,276825,303264,264644,256638,10992,202825,172324,192181,88931,267822,289119,12666,212280,214268,245694,277406,277410,172841,61377,113117,132650,101950,223170,202674,202673,202679,202672,202704,168787,168784,312305,181144,189105,48879,301271,75311,278419,289081,291871,293040,149785,193837,203703,214426,112563,130470,245438,225775,100426,115235,203895,48794,203891,130314,322661,266212,294675,294887,304720,269232,278430,283322,285244,205219,245236,256579,260502,277405,212098,249003,269126,323277,172950,252610,276811,291366,288973,323328,267809,289122,299171,304942,255425,264970,278253,61382,88295,88286,132652,168783,61929,202676,202677,202678,223171,202675,75326,103481,75334,217507,217508,195907,217506,251269,320398,159077,161357,197700,195599,218442,210669,267463,284994,276817,307417,306714,326221,326162,326319,321307,251944,145264,11788,173153,75612,267654,283227,286210,290621,299150,299149,305126,326829,327105,330333,58507,58508,119052,277403,284192,291813,58492,261807,289693,322473,133828,242402,268318,294890,300612,305649,311616,154640,24217,192506,218343,264089,134481,277970,303946,326743,331032,305040,172483,170100,248994,249045,251570,252397,263632,210670,272159,287446,276916,297428,307231,323396,329182,150758,330776,268281,268241,280167,289095,290706,291700,298799,301138,61944,214583,219799,220447,220446,144632,73880,284191,296153,320399,133830,1179,251525,251943,262963,262979,262974,262486,22111,22124,276974,284344,277802,304876,304875,326129,220958,282148,291747,291746,293061,293058,298795,323993,262922,303609,251569,262804,195509,264112,263397,280968,289186,289600,276813,286992,297221,303618,175980,328976,329269,204909,209601,251942,248793,251918,225787,225790,254583,312335,304879,329433,326882,330989,330959,331043,331034,331053,331048,109120,217499,207557,75328,217501,36622,223177,252482,252835,262113,143454,103957,248900,288157,293062,298804,298926,305052,322598,322474,326807,169896,192359,320395,144859,147482,22099,147060,62189,123901,275840,279441,283981,304461,312336,304877,324485,328610,329952,331025,331022,161632,249639,249321,268153,268984,284748,287528,287522,286991,296572,316372,306785,326254,140058,7688,114201,263620,42175,147161,273407,278662,280403,144630,323790,323787,24191,267703,267657,277897,288138,294866,80476,57208,218348,108813,23961,251931,225806,225807,251930,278758,24160,284331,288213,296664,24214,323180,323610,326741,330985,331003,331052,264483,262977,264457,270909,279061,278759,278761,284328,22117,22118,305021,304874,318989,287866,310621,330982,330988,330963,330969,331033,330978,330952,331038,331042,196538,203917,207852,227302,220596,252085,252300,252228,260769,263782,287516,304306,307906,306875,310128,316371,322658,326324,329111)
and ltrim(rtrim(lower(a.brand))) = 'north american arms'
and a.of3='22 LR'
group by a.style_id
order by instock desc, ranking asc
|