I want to write a stored procedure in the SQL database, but to bring conditions
CodePudding user response:
If your condition is need to define an incoming outside the incoming parameters, then refer to the parameter conditions, specific can baidu [with parameters of SQL server storage process]
CodePudding user response:
reference 1st floor xiaodai511 response: if your condition is need to define an incoming outside the incoming parameters, then refer to the parameter conditions, specific can baidu [with parameters of SQL server storage process] If the database statements to group by using the sum function how to do CodePudding user response:
Storage can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what results CodePudding user response:
Conditions through parameter to pass CodePudding user response:
refer to February 16 reply: 3/f store can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what On condition that time with customers CodePudding user response:
reference 5 floor barbie bear reply: Quote: refer to the third floor February 16 response: store can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what Condition that time with the customer Add two parameters, a time a customer CodePudding user response:
reference floor 6 February 16 response: Quote: barbie bear reference 5 floor response: Quote: refer to the third floor February 16 response: store can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what Condition that time with the customer Add two parameters, a time a customer can That how do I build a temporary table fields, and then put out the field displayed together CodePudding user response:
refer to 7th floor barbie bear response: Quote: refer to the sixth floor February 16 response: Quote: barbie bear reference 5 floor response: Quote: refer to the third floor February 16 response: store can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what Condition that time with the customer Add two parameters, a time a customer can That how do I build a temporary table fields, and then out of the fields displayed together Don't have to build a temporary table, directly in the select a stored procedure can receive data CodePudding user response:
reference 16 February 8 floor response: Quote: barbie bear reference 7 floor response: Quote: refer to the sixth floor February 16 response: Quote: barbie bear reference 5 floor response: Quote: refer to the third floor February 16 response: store can pass parameters; Sum group by directly in a written statement, Your problem can be described in detail, such as what data, want to pass through stored procedures what parameter, what Condition that time with the customer Add two parameters, a time a customer can That how do I build a temporary table fields, and then out of the fields displayed together Don't have to build a temporary table, directly in the select a stored procedure can receive data I want since the period of a table can also be, isn't it, as well as conditions, have customer name to display a customer name, no customer name of all, how do I write the day conditions CodePudding user response:
Suggest you list the table structure, and provide test data and based on these test data that corresponds to the correct result, Refer to the way the post questions http://bbs.csdn.net/topics/320211382 1. You create table XXX.. Statement 2. You insert into XXX... Statement 3. The result is what kind, and give a simple algorithm description) 4. Do you use the database name and version of (often asked in MS SQL server edition MySQL) CodePudding user response:
Conditions when the incoming parameters CodePudding user response:
A data source, data source, No data source, to define a data structure, can be written as a temporary table structure, also can use table variables, In a structure on the basis of, and then to define its execution logic, Purpose, is to achieve the final result, you have to put the data that you know background, or only business background in detail, and ultimately to achieve demand as a result, So you have some clear thinking and approach, CodePudding user response:
Please see my blog posts have the detail or watch my personal web site, www.aolanghs.com CodePudding user response:
Create or replace the stored procedure name ( Time fields IN the field type, Customers IN the field type, Customer name out the field type) As The existence of mid_count field type; The begin Select count (*) into mid_count from the customer table where customer=; If mid_count & gt; 0 then select customer name into customer name from, and where,, The else Creat a temporary table Insert into a temporary table values (); end if; end loop; end; CodePudding user response:
The cited the 17th floor Zoe_YuZu reply: create or replace the stored procedure name ( Time fields IN the field type, Customers IN the field type, Customer name out the field type) As The existence of mid_count field type; The begin Select count (*) into mid_count from the customer table where customer=; If mid_count & gt; 0 then select customer name into customer name from, and where,, The else Creat a temporary table Insert into a temporary table values (); end if; end loop; end; If I call a stored procedure parameters how to write but time become