. Handling ResultSetwhile (Rs.next ()) {rs.get+ the corresponding type + in the database (the corresponding column alias in the database)Switchtype (types,fieldsplit,rs,resultlist);}return resultlist;} catch (Exception e) {E.printstacktrace ();return null;}finally{Rs.close ();Preparestatement.close ();Connection.close ();}}private void Switchtype (string[] types, string[] field, ResultSet RS, List resultlist) throws SQLException {List arr = new ArrayList ();for (int i = 0; i Listadd (Rs,types[i]
The Microsoft Live Laboratory, which is known for its image processing, recently released a new novel: Pivot. After the launch of the first impression is a browser, and IE, FF, chrome and not the same is, pivot exquisite and gorgeous. But look at installation requirements: 256M of video memory, Win7 or Vista system, and install. NET Framework3.5 and IE8, the browser can not need this luxurious configuration
Write in frontToday rest, take time to understand the next pivot and Unpivot, remember the teacher when the row to the column, it seems mentioned, but he said the most is "this you can learn privately, very simple ...", simple you do not say, do not spit groove him, or well tidy up the content of the morning self-study.Pivot operator for pivot conversionPerspective transformation refers to the processing of
In power pivot, you can create data models from a variety of data sources based on your requirements, and you can refresh the data whenever you need to. In the previous article, Anna was ready to load the data into the power pivot. Power Pivot is one of the tools that creates and manages tabular data and relationships between tables in Excel.
Anna, after loading
Tags: note span print log spin BER TTY aggregate GroupThe pivot clause is a new feature of Oracle database 11g that enables you to rotate rows into columns in the query output and use aggregate functions on the data. The UNPIVOT clause is also added, and he can rotate columns into rows in the query output;IntroducedThe following table data is now available: (not shown completely ...) ) Now we want to observe (1, 2, 3) the sales of each type of ID in t
Tags: SQL Server column career pivotToday is just the data show, using the column change, there are many ways to change the line, pivot is one of them, Povit is the function of SQL Server 2005, The following business scenario: Each month, the total quantity of the incoming channel is "totals", in Chinese, English, and other data columns, The original data is as follows: Demand: The data needs to be displayed as one line per year from January to Dece
Case Syntax:Exercise 1: Show gender 0, 1 as male, femaleSelect * fromStudentinfo--Case : Judging columns in the result set--Example 1: Display student information, gender as "male and female" display:Select *, CaseSgender when 1 Then 'male' when 0 Then 'female' End asSex fromStudentinfoView CodeResults:Exercise 2: Show the score as "excellent, good, medium and poor"--Example 2: The student score is displayed as a grade >=90 excellent, >=80 good, >=60, other poorSelect *, Case
Tags: when case png shang pivot Red data row goto EnglishThe existing table, the original data is as follows: Now you need to query the following results (conditions are: [80,~] Excellent, [60,80) pass, [~,60] failed):The original table is converted with UNPIVOT, and the line changes to select * from CB_SHANGCICB UNPIVOT ("language", "math", "English"), and the results are as follows: The CJ is then matched with the band TT as (select * FROM Score Unp
Pivot Unpivot 11g new Features1Pivotin columns - value In the form of a pair, a typical row-to- column report function . Createtabletest_demo (Idint,namevarchar (), numsint);---- CREATE TABLE Insertintotest_demovalues (1, ' Apple ', 1000);insertintotest_demo VALUES (2, ' Apple ', 2000); Insertintotest_demovalues (3, ' Apple ', 4000); insert intotest_demovalues (4, ' orange ', 5000); Insertintotest_demovalues (5, ' oranges ', 3000), insertintotest_
Tags: var stc date final Code folders Sam original endIn general, the pivot () function can only be written to die in, because pivot () in does not support subqueries, so this can only be solved with stored procedures; CREATE PROCEDURE Insurancepivot @Foldercode VARCHAR (50), @isY VARCHAR (4) As BEGIN DECLARE @ColumnNames VARCHAR (3000) SET @ColumnNames = ' ' SELECT @ColumnNames = @ColumnNames + ' [' + Test
Label:A data table in the field of years, months, days, amounts, payment methods and other fields, and now want to write a SQL statement, each day of the payment method amount (The payment method has multiple) row in the same line, Finally, add a column subtotal to the amount of all the current payment methods. Such as: The result of the original SQL query is this: ------------------------------------------------------------------------------------------- And then the SQL results that you want t
Tags: sum share picture statistics overseas tail nio share over SQLWhen it comes to statistics, it is often a problem to change rows and columns. Case when mode is too cumbersome, and scalability is not strong, you can use Pivot,unpivot to quickly achieve row to column, column change, and Scalability strong First, row to column 1. Test data Preparation CREATE TABLE [studentscores]
(
[UserName] NVARCHAR, --Student name
[Subject]
1. Basic Tables2. Row to column, note the use of ISNULL function, in the overall statistics, ISNULL (-,0) is necessary to use3. The list of career changes, the list of languages, mathematics, English, politics, the conversion to 2 columns, score scname These two columns, is a new column, can be named Score11 Scname22, casual4. Test scriptsSELECT * fromdbo. SC--inserting test DataINSERTdbo. SCSELECT NEWID(),'001','Jack1','Mathematics', theUNIONSELECT NEWID(),'002','Jack2','language', -UNIONSELEC
Label: -- query results before rotation
SelectS.name Shiftname,h.businessentityid,d.name asDpartmentname fromhumanresources.employeedepartmenthistory HInner JoinHumanResources.Department D onH.departmentid=D.departmentidInner JoinHumanresources.shift S onS.shiftid=H.shiftidWHEREENDDATE is NULL andD.nameinch('Production','Engineering','Marketing')
Order byShiftname --the result after rotation
Selectshiftname,production,engineering,marketing from
(SelectS.name Shiftname,h.businessentityid,
SelectOper_time, Micropay, REFUND from ( Selecttrunc (oper_time) oper_time, class_name, sum (total_fee) Total_fee fromWx_pay_detail GROUP by Trunc (Oper_time), class_name) pivot (sum (total_fee) forClass_nameinch ('Micropay' as "Micropay",'Refund' as "REFUND") ) Order by Oper_time↑sql, post-conversion column names in for ... In as desired "name"Oracle according to the "date" group, other criteria according to
Analysis: In fact, it is the time of the month row to the columnTable structure Design:Results:Select Name,moth,isnull ([01],0) as Value1,isnull ([02],0) as Value2,isnull ([03],0) as Value3 from (Select A.name,convert (varchar (4), moth,120) as Moth,convert (varchar (2), moth,100) as Moth2,number from Table_type as aLeft join Table_shuju as B on a.id=b.idAs Table1 pivot (SUM (number) for moth2 in ([01],[02],[03])) as Table2:A SQL plane question about
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.