select
dt.extension,
dt.firstinit TEC,
dc.surname,
dc.firstname,
dc.division DivShiptTo,
gg.parentgroupid ConfigShipTo,
dt.extgroupunique ExtnGroup,
dc.location[1,10]
from directtemplate dt, directcustom dc,
     OUTER gengroup gg, groupname gn
where dt.recordno = dc.recordno
  and dt.extgroupunique = gn.grid
  and gn.grid = gg.childgroupid
--#  and dt.firstinit is not null and dt.firstinit != " "
  and dt.extension in (
6301,
6308,
6325,
6351,
6361,
6378,
6419,
6433,
6471,
6512,
6515,
6533,
6543,
6584,
6637,
6638,
6639,
6640,
6641,
6642,
6643,
6645,
6646,
6649,
6654,
6657,
6664,
6666,
6671,
6673,
6688,
6709,
6716,
6718,
6900,
6901,
6902,
6903,
6904,
6905,
6907,
6908,
6909,
6910,
6911,
9007,
9104,
9107,
9108,
9109,
9166,
9168,
9184,
9414,
9599,
9633,
9642,
9712,
9376,
9823,
9459,
9605,
9472,
9658,
9350,
9130,
9797,
9718,
9497,
9492,
9302,
9189,
9770,
9347,
9180,
9579,
9280,
9485,
9175,
9370,
9484,
9241,
9594,
9740,
9081,
9489,
9561,
9187,
9404,
9368,
9155,
9881,
9615,
9876,
9260,
9697,
9290,
9179,
9313,
9267,
9271,
9403,
9258,
9380,
9128,
9436,
9875,
9311,
9174,
9664,
9575,
9775,
9471,
9493,
9841,
9348,
9289,
9205,
9413,
9747,
9576,
9462,
9831,
9255,
9774,
9157,
9150,
9587,
9178,
9466,
9604,
9894,
9529,
9668,
9129,
9112,
9487,
9103,
9807,
9186,
9191,
9154,
9522,
9192,
9276,
9127,
9345,
9083,
9343,
9769,
9298,
9373,
9715,
9477,
9751,
9722,
9244,
9679,
9428,
9749,
9304,
9379,
9419,
9470,
9541,
9526,
9448,
9848,
9218,
9486,
9717,
9344,
9360,
9169,
9170,
9824,
9463,
9591,
9577,
9482,
9335,
9381,
9551,
9339,
9194,
9213,
9449,
9359,
9602,
9661,
9429,
9844,
9422,
9113,
9542,
9598,
9843,
9137,
9465,
9228,
9527,
9830,
9190,
9259,
9420,
9162,
9125,
9176,
9185,
9395,
9407,
9197,
9141,
9662,
9503,
9660,
9229,
9207,
9266,
9469,
9173,
9495,
9416,
9457,
9117,
9250,
9147,
9887,
9230,
9837,
9782,
9811,
9336,
9273,
9443,
9765,
9499,
9248,
9435,
9364,
9762,
9886,
9084,
9729,
9412,
9742,
9120,
9224,
9590,
9453,
9172,
9135,
9393,
9351,
9252,
9399,
9327,
9699,
9046,
9809,
9570,
9265,
9685,
9363,
9340,
9760,
9467,
9301,
9895,
9659,
9405,
9159,
9808,
9296,
9410,
9317,
9549,
9684,
9123,
9713,
9382,
9761,
9509,
9498,
9353,
9491,
9871,
9274,
9672,
9203,
9753,
9558,
9711,
9750,
9593,
9878,
9310,
9118,
9272,
9614,
9490,
9257,
9424,
9682,
9217,
9654,
9461,
9779,
9111,
9768,
9181,
9736,
9548,
9804,
9666,
9700,
9417,
9300,
9195,
9447,
9211,
9647,
9297,
9278,
9758,
9595,
9494,
9635,
9305,
9676,
9232,
9357,
9322,
9445,
9555,
9210,
9219,
9358,
9863,
9832,
9776,
9202,
9515,
9249,
9227,
9451,
9198,
9798,
9757,
9677,
9708,
9766,
9734,
9115,
9621,
9724,
9321,
9513,
9309,
9880,
9152,
9425,
9337,
9209,
9552,
9158,
9714,
9269,
9398,
9825,
9543,
9177,
9105,
9253,
9212,
9153,
9777,
9372,
9518,
9771,
9538,
9415,
9763,
9132,
9234,
9406,
9545,
9746,
9454,
9723,
9295,
9710,
9748,
9705,
9182,
9877,
9286,
9409,
9160,
9235,
9292,
9167,
9772,
9730,
9408,
9818,
9275,
9483,
9523,
9687,
9188,
9261,
9716,
9780,
9223,
9572,
8258,
9246,
9365,
9455,
9586,
9794,
9247,
9303
)
ORDER BY extension
