Particular record on top of the records
when i run below query select distinct d.prinbr, d.prttls FROM sqts_main_lear a INNER JOIN gen_plant_master d ON a.PRINBR = d.PRINBR WHERE record_deleted = 'N' union select '0' as prinbr, 'All' as prttls order by d.prttls 300 ADV ASSY-COLUMBIA CITY 0 All *JN CL AUTO LLC - NEWARK ISD *JM CL AUTO LLC- HIGHLAND ISD 485 IAC ALMA, LLC KH IAC AUTO COMP AB MAPLE OC IAC AUTO COMP. AB MISSISA O1 IAC CARLISLE, LLC 488 IAC DAYTON, LLC 484 IAC EDINBURGH, LLC KA IAC FREMONT KB IAC GREENCASTLE, LLC Q10 IAC GROUP - FARGELANDA 223 IAC GROUP - LOZORNO How can i bring "0 and All" on the top when query returns the records??SSRSRpt
January 18th, 2011 11:20am

Hi Pratul_sri, try something like this:- CREATE TABLE #TEMP ( prinbr VARCHAR(50), prttls VARCHAR(50) ) INSERT INTO #TEMP VALUES ('300', 'ADV ASSY-COLUMBIA CITY') INSERT INTO #TEMP VALUES ('*JN', 'CL AUTO LLC - NEWARK ISD') INSERT INTO #TEMP VALUES ('*JM', 'CL AUTO LLC- HIGHLAND ISD') INSERT INTO #TEMP VALUES ('485', 'IAC ALMA, LLC') INSERT INTO #TEMP VALUES ('KH', 'IAC AUTO COMP AB MAPLE') INSERT INTO #TEMP VALUES ('OC', 'IAC AUTO COMP. AB MISSISA') ;WITH CTE AS ( SELECT prinbr, prttls, ROW_NUMBER() OVER(PARTITION BY prinbr, prttls ORDER BY prinbr, prttls) AS ROW FROM #TEMP UNION SELECT '0' AS prinbr, 'All' AS prttls, 0 AS ROW ) SELECT prinbr, prttls FROM CTE ORDER BY ROW, prttls DROP TABLE #TEMP Please let us know your feedback. Thanks KumarKG, MCTS
Free Windows Admin Tool Kit Click here and download it now
January 18th, 2011 11:31am

I've to use DB table which existing and there are 2000 distinct plants. I need to modify my query which i posted earlier in my question. Can you think of some solution around that query?? thanks,SSRSRpt
January 18th, 2011 11:59am

Hi Pratul_sri, Sorry I'm unable to understand your question. Would be please elaborate it briefly. Thanks KumarKG, MCTS
Free Windows Admin Tool Kit Click here and download it now
January 18th, 2011 12:04pm

Hi, Since this is the Reporting Services forum, do you want to return records base on specified order? If so, you can add a custom field to represent the order and then sort the report base on this field. Another similar thread you can refer to: http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/95810c6e-bf91-45f2-a8fa-7257680ad59d Thanks, RaymondRaymond Li - MSFT
January 20th, 2011 3:18am

Hi, Since this is the Reporting Services forum, do you want to return records base on specified order? If so, you can add a custom field to represent the order and then sort the report base on this field. Another similar thread you can refer to: http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/95810c6e-bf91-45f2-a8fa-7257680ad59d Thanks, RaymondRaymond Li - MSFT
Free Windows Admin Tool Kit Click here and download it now
January 20th, 2011 3:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics