ready2drum Posted December 31, 2009 Share Posted December 31, 2009 The following query is set up to display results based on the Year and Month. I need help in figuring out how to go about setting up the query so that when the user runs the report, they can select the Month and Year of the their choosing from a drop down list.See code below: SELECT invent.prod_mach_id AS Machine, jo.jo_id AS Reel_ID, dbo.CVTRRR(invent.ts_scaled) AS Scaled_Time, invent.unit_id AS Roll_Number, invent.grade_spec_made AS Grade_Spec_Made, invent.grade_spec AS Grade_Spec_Sold, invent.diam_act AS Diameter_Actual, invent.diam_ord AS Diameter_Ordered, invent.width_act AS Width_Actual, invent.width_ord AS Width_Ordered, invent.wgt_est AS Est_Weight, invent.wgt_scaled AS Actual_Weight, invent.class AS Roll_Class, invent.length_lineal AS Lineal_Footage, density.wgt_per_width AS Target_Density, jo.length_turnup AS Jo_lengthFROM invent LEFT OUTER JOIN jo ON invent.parent_id = jo.jo_id LEFT OUTER JOIN density ON invent.prod_mach_id = density.machine_id AND invent.grade_spec = density.grade_spec AND invent.diam_ord = density.diameter AND density.active_flag = 'Y'WHERE (invent.stat = 'G') AND (density.active_flag = 'Y') AND (density.machine_type = 'WD') AND (invent.unit_id LIKE 'GP1%9K%')ORDER BY invent.unit_id, jo.jo_id [in the 'Where' statement, the '9' represents 2009 and the 'K' represents October. ]The report runs fine in MS Visual Studio (SQL Server Business Intelligence Development Studio) and it runs fine in MS SQL Server 2005.Any suggestions would be extremely appreciated!Thanks in advance! Link to comment Share on other sites More sharing options...
justsomeguy Posted December 31, 2009 Share Posted December 31, 2009 You need a form with your dropdowns, and a page to process the form and substitute the values into the query. Link to comment Share on other sites More sharing options...
ready2drum Posted December 31, 2009 Author Share Posted December 31, 2009 I can set up the form, page, and then substitute the values into the query...would be very helpful if there was a sample/example online somewhere that will show what it might look like when it's completed. Do you know of any? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 4, 2010 Share Posted January 4, 2010 I don't know of any examples online that are specific to your situation, you should find plenty of things online where people substitute form values into a query though. In fact, the majority of ASP or PHP scripts which use both forms and databases do that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.