Return top 10 from data set

  • I'm trying to get the top ten problems for each ProvName in the table based on the number of patients.

    create table dbo.TEST

    as

    (

    ProvName varchar(50),

    diag varchar(10),

    Problem varchar(100),

    Patients int

    )

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','(Lower) Leg Tenderness On Ambulation Gastrocnemius',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Abdominal pain right upper quadrant',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Abused As Child Verbally',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Accidental Obstruction Of Respiratory Tract From An Ingested Bone',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Acute combined systolic and diastolic congestive heart failure',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Adopted',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Adult Psychological Abuse By Spouse / Partner',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Adverse Effect Of Caffeine',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Adverse Effect Of Oral Contraceptive',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Alcohol',7)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Alcohol Use',85)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','allergic rhinitis_',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Allergies',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Anal itch',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Anemia NOS',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','At risk for bleeding',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','At risk for diabetes mellitus',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','At risk for hepatitis',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Axis IV Psychosocial And Environmental Problems',8)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Axis V Global Assessment Of Functioning (GAF) Scale',8)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Back Pain',16)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Back pain_',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Behavioral Problems',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Being A Social Drinker',452)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Birth Control Method',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Birth Control Not Practiced',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Bisexual',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Body mass index',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','BREAST DISORDER NOS',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Breast Lump',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Breast Palpation Diffuse Fibrous Tissue Bilateral',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Buttock Tissue Injury Contusion',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Caffeine Use',113)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Carrier of methicillin resistant Staphylococcus aureus',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Cath Stent Placement',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Cellulitis Lower Extremities',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Cellulitis of extremity',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Cerebrovascular accident NOS',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','cervical screen',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Chancre Labia Bilateral',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Child In Custody Of Foster Parents',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Chills',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Cocaine',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Collision With A Car On A Road',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Colonization with MRSA (methicillin-resistant staphylococcus aureus)',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Colonoscopy (Fiberoptic) Screening',21)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'ARSHAD M.D.,SAARAH',' ','Conjunctivitis (unspecified)',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.7','Type 2 diabetes mellitus with other circulatory complications',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.72','DM (diabetes mellitus) type II uncontrolled, periph vascular disorder',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.8','Diabetic foot ulcer',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.8','Type 2 diabetes mellitus with other manifestations',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.81','Diabetic toe ulcer in type 1 diabetes mellitus',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.81','Type 1 diabetes mellitus with diabetic gastropathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','250.9','Diabetes mellitus with complication',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','251.2','Hypoglycemia',11)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','252','Hyperparathyroidism',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','252.01','Primary hyperparathyroidism',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','252.08','Other hyperparathyroidism',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','252.1','Hypoparathyroidism',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.2','Hypopituitarism',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.4','Anterior pituitary disorder',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.5','Neurohypophyseal diabetes insipidus',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.6','SIADH (syndrome of inappropriate ADH production)',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.8','Empty sella syndrome',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.8','Empty sella turcica',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','253.9','Pituitary disorder',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','255.1','Primary hyperaldosteronism',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','255.8','Adrenal incidentaloma',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','255.8','Elevated dehydroepiandrosterone sulfate level',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','255.9','Adrenal disorder',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','255.9','Adrenal mass',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.31','Premature menopause',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.39','Estrogen deficiency',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.4','PCOS (polycystic ovarian syndrome)',26)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.4','Polycystic ovarian syndrome',5)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.4','Polycystic ovaries',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.4','Polycystic ovary syndrome',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','256.8','Premature ovarian failure',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','257.2','Hypogonadism, male',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','257.2','Low testosterone',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','257.2','Testosterone deficiency',4)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','259.9','Abnormal FSH level',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','259.9','Elevated testosterone level in female',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','259.9','Endocrine Disorder',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','262','Improper Nutrition',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','263.9','Malnutrition',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','265.1','Thiamine deficiency',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','265.1','Vitamin B1 deficiency',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','B12 deficiency',41)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','Folate deficiency',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','Folic acid deficiency',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','Low vitamin B12 level',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','Vitamin B12 deficiency',38)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','266.2','Vitamin B12 nutritional deficiency',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','268.9','Avitaminosis D',10)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','268.9','Excess or deficiency of vitamin D',5)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','268.9','Hypovitaminosis D',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'CHAPARALA M.D.,SUJANA','268.9','Mild vitamin D deficiency',24)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','354.2','Cubital tunnel syndrome on left',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','354.2','Cubital tunnel syndrome on right',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','354.2','Ulnar nerve compression',5)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','354.2','Ulnar nerve palsy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','354.4','Causalgia of upper limb',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.3','Common peroneal neuropathy of right lower extremity',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.6','Morton's metatarsalgia, left',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.6','Morton's metatarsalgia, right',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.9','Complex regional pain syndrome',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.9','Diabetic Amyotrophy/Mononeuritis Multiplex',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.9','Neuropathy',5)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','355.9','Peripheral nerve palsy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','356.4','Idiopathic progressive polyneuropathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','356.9','Idiopathic polyneuropathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','356.9','Peripheral neuropathy',35)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','356.9','Polyneuropathy',11)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','357','Guillain-Barre syndrome',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','357.2','Diabetic Peripheral Neuropathy Type 1',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','357.2','Diabetic Polyneuropathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','357.5','Neuropathy, alcoholic',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','358','Myasthenia Gravis',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','358','Myasthenia gravis without exacerbation',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','359.1','Progressive muscular dystrophy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','359.9','Myopathy Secondary To',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','361.05','Total retinal detachment of right eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','361.06','Old partial retinal detachment',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','361.1','Retinoschisis',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','361.31','Round Hole Of Left Retina Without Detachment',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','361.9','Retinal detachment',3)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.04','Mild Nonproliferative Diabetic Retinopathy Of The Left Eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.05','Moderate Nonproliferative Diabetic Retinopathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.07','Diabetic Macular Edema Of The Right Eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.11','Hypertensive retinopathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.3','Embolism involving retinal artery',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.3','Retinal vessel occlusion',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.32','Branch retinal artery occlusion of left eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.32','Retinal arterial branch occlusion',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.33','Hollenhorst plaque, left eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.34','Amaurosis fugax',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.36','Branch retinal vein occlusion',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.37','Incipient Retinal Vein Occlusion',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.41','Chronic Central Serous Retinopathy',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.5','Macular degeneration',8)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.5','Macular degeneration of both eyes',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.51','Age-related macular degeneration, dry',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.51','Nonexudative macular degeneration',6)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.52','Exudative macular degeneration',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.54','Macular Hole In The Left Eye',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.54','Retinal hole',2)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.56','Epiretinal membrane, both eyes',1)

    insert into TEST(ProvName, diag, Problem, Patients) values( 'COVETT D.O.,ROBERT G.','362.56','Epiretinal membrane, right eye',1)

  • This doesn't take into account matches (when there are ties in position 10 for the number of patients). If you are ok with that then you should also add a secondary sort column in the ROW_NUMBER window function to ensure the same rows are always returned.

    with MySort as

    (

    select ProvName

    , diag

    , Problem

    , Patients

    , ROW_NUMBER() over (partition by ProvName order by Patients desc) as RowNum

    from TEST

    )

    select ProvName

    , diag

    , Problem

    , Patients

    from MySort

    where RowNum <= 10

    order by ProvName, RowNum

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Thanx.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply