|
csphard
Posting Yak Master
113 Posts |
Posted - 2005-12-15 : 14:37:44
|
| I use the following sql to randomly get 200 records. Then after I have gotten information I use a derived table to put that information in order. My problem is that the result using query analyzer seem to use more information than when I query that information using ASP.Is there anything I should know about using newid. Also is there a way to weight this. Meaning I have some groups I want to come up more than others. I hope I was clear on what the problem is.I appreciate your help.select l.lname,l.fname,l.empid,l.item,l.pay_location,l.sub,l.bureau,l.division,l.eval_type, l.begindate,l.enddate,l.bname,l.dname from ( select top 200 e.lname,e.fname,e.empid,e.item,e.pay_location,e.sub,e.bureau,e.division, d.eval_type, convert(varchar,d.fromdate,101) as begindate, convert(varchar,d.todate,101) as enddate, o.org_name as bname, n.org_name as dname from emp_information_test e,due_evals d,new_organization o,new_organization n WHERE e.item Not in (0845,1004,1060,2574,8008,8013,8014,8015,8016,8017,8019,8023,8645,9421) and e.deptno <> '999' and e.empid = d.empid and d.eval_type <> 'Probation' and e.bureau is not null and e.bureau = o.org_id and o.type = 'BUREAU' and e.division = n.org_id and n.type = 'DIVISION' and datepart(yyyy,d.datetobefiled ) = '2005' and e.empid LIKE '_[123]%' order by NEWID() ) L order by l.pay_location |
|