Hi,I thought the following task would be easy but I'm realizing that it's a bit tricky. I'm hoping someone can help me out.What I've started is a query in the pubs database that lists all ofthe employees with an ascending counter. Note that this counter isgenerated dynamically:USE pubsGOSELECT emp_id, fname, lname, job_id, (SELECT COUNT(*) FROM employee e2 WHERE e2.lname <= e.lname) AS rownumber FROM employee e ORDER BY lname GO=====================================================emp_id fname lname job_id rownumber=====================================================PMA42628M Paolo Accorti 13 1PSA89086M Pedro Afonso 14 2VPA30890F Victoria Ashworth 6 3H-B39728F Helen Bennett 12 4L-B31947F Lesley Brown 7 5F-C16315M Francisco Chang 4 6PTC11962M Philip Cramer 2 7A-C71970F Aria Cruz 10 8AMD15433F Ann Devon 3 9...
What I'm trying to accomplish is to be able to group the employeesby job_id and have the counter start over at 1 with each new job_idgroup as shown below:=====================================================emp_id fname lname job_id group_id=====================================================PTC11962M Philip Cramer 2 1AMD15433F Ann Devon 3 1F-C16315M Francisco Chang 4 1PXH22250M Paul Henriot 5 1CFH28514M Carlos Hernadez 5 2JYL26161F Janine Labrune 5 3LAL21447M Laurence Lebihan 5 4RBM23061F Rita Muller 5 5SKO22412M Sven Ottlieb 5 6MJP25939M Maria Pontes 5 7VPA30890F Victoria Ashworth 6 1MGK44605M Matti Karttunen 6 2DWR65030M Diego Roel 6 3A-R89858F Annette Roulet 6 4...
Like I said, I thought this would be easy but I'm stumped. Any ideas?Bill