I'm not sure what you want to achieve...
Maciej Los - wrote:
Based on which condition do you want to divide employees on groups?
R_sharma - ago wrote:
any condition sir. i am not getting key to solve this question. could you please guide me to approach this and this type of questions.thanks
Example for "any" (where "any" means:
empid modulo 2
)condition to group employees:
SELECT empid, emp_name, [Add], emp_phno, CONVERT(INT, (empid % 2) +1 ) AS grp_emp
FROM @emp
ORDER BY CONVERT(INT, (empid % 2) +1 )
Result:
100 rachit 516-a 8696953366 1
104 bobby 76A 7899877899 1
102 kishor 77/A 8989689896 1
103 dharam 2519 7765477654 2
101 ush 25/a 7737708131 2
105 unnet sfgcsy 986547896 2