pivot

Table column split to two columns in sql?

坚强是说给别人听的谎言 提交于 2020-01-23 23:08:36
问题 In sql server, I have once column in the table, i want to make the column in two column, in the other table [new table]. Can you help me. ------------------------ Type ------------------------ UserDefine UserDefine AutoGenerate AutoGenerate UserDefine ------------------------- The above is my column in one of my table now i want to make the column in two like UserDefine and Autogenerate column in different table ----------------------------------- UserDefine | AutoGener | --------------------

MS SQL: alter indexed view by including additional columns from new table

假如想象 提交于 2020-01-23 08:59:39
问题 I need to update existing MS SQL indexed view by including additional columns values from newly created table. Indexed view: CREATE OR ALTER VIEW [dbo].[MySelectionInfo] WITH schemabinding AS SELECT C.Id id0, C.Code Code1, C.Name Name2, C.ProgramLevel Level3, C.Department Department4, C.City City10, C.STATE State11, C.StartDate StartDate12, C.Deadline Deadline13, B.ID Table_B_ID, A.Id Table_A_ID FROM dbo.Table_A A INNER JOIN dbo.Table_B B ON A.id = B.Table_A_Id INNER JOIN dbo.Table_C C ON C

setPivotX works strange on scaled View

故事扮演 提交于 2020-01-22 11:02:06
问题 I found out that setPivotX (also setPivotY ) works strange in Android. If you set pivot when view's scale is set to 1.00f nothing happens (just pivot changes). But if the scale isn't equal 1.0f (e.g. setScaleX(0.9f) ) and you set the pivot the view moves relatively(?) to the new pivot. Isn't it strange? I know that horizontal and vertical positions (translations) are NOT related to the pivot value, but why the view moves with scale factor other than 1.0f? Please check this out with and

setPivotX works strange on scaled View

≯℡__Kan透↙ 提交于 2020-01-22 11:02:04
问题 I found out that setPivotX (also setPivotY ) works strange in Android. If you set pivot when view's scale is set to 1.00f nothing happens (just pivot changes). But if the scale isn't equal 1.0f (e.g. setScaleX(0.9f) ) and you set the pivot the view moves relatively(?) to the new pivot. Isn't it strange? I know that horizontal and vertical positions (translations) are NOT related to the pivot value, but why the view moves with scale factor other than 1.0f? Please check this out with and

DB2 Pivot (rows to columns)

隐身守侯 提交于 2020-01-17 07:27:21
问题 I have data like this in a DB2 table like below. Server Name Job ID Job Status SERVER_A 00000001 Success SERVER_A 00000002 Failure SERVER_A 00000003 Success SERVER_B 00000004 Failure SERVER_B 00000005 Failure SERVER_B 00000006 Failure SERVER_C 00000007 Success SERVER_C 00000008 Success SERVER_C 00000009 Success I need to display results as below. Server Name Success Failure SERVER_A 2 1 SERVER_B 0 3 SERVER_C 3 0 回答1: Solution 1 select ServerName, sum(case when JobStatus='Success' then 1 else

How to transpose rows into columns in SQL Server?

徘徊边缘 提交于 2020-01-17 06:29:31
问题 I have been working on how to transpose or pivot this table but after working for so many hours I am still stuck on this, can you please help me? My table looks like this: CREATE TABLE Table1 ( `Time` datetime, `IN` int, `OUT` int ); INSERT INTO Table1 (`Time`, `IN`, `OUT`) VALUES ('2017-04-05 15:53:00', 40, '35'), ('2017-04-05 15:24:00', 40, '35'), ('2017-04-05 15:23:00', 40, '35'), ('2017-04-05 14:22:00', 42, '40'), ('2017-04-05 14:21:00', 42, '40'), ('2017-04-05 14:20:00', 42, '40'), (

how to preserve column names on dynamic pivot

笑着哭i 提交于 2020-01-17 06:19:29
问题 Sales data contains dynamic product names which can contian any characters. Dynamic pivot table is created based on sample from Crosstab with a large or undefined number of categories translate() is used to remove bad characters. In result pivot table column names are corrupted: missing characters and spaces are removed. How to return data with same column names as in source data ? I tried to use quote_ident(productname) as tootjakood, instead of 'C'||upper(Translate(productname,'Ø. &/+-,%',

local mesh rotation without geometry translate and pivot (THREEJS)

北城余情 提交于 2020-01-17 06:15:30
问题 I try to apply a "local rotation" to a mesh in THREEJS. I want to rotation to be applied around the geometry center but it is applied around the geometry "origin" (0, 0, 0). Assumption: I can not modify the geometry. What I do right now: mesh3D.position.copy(worldPosition); mesh3D.rotation.setFromRotationMatrix(localRotation); mesh3D.updateMatrixWorld(true); Is the only solution to use a pivot somehow? I'd also like to avoid that as it changes the object children hierarchy... Thanks 回答1: To

SQL Server dynamic Pivot with datetime

梦想与她 提交于 2020-01-16 08:49:13
问题 I'm trying to pivot join_date ( datetime ) column and split it by year + month and group by mtype and it must be dynamic as the date will change. TABLE +-------+------------------+ | Mtype | join_date | +-------+------------------+ | A | 28/05/2014 00:00 | | B | 04/11/2014 00:00 | | C | 23/03/2007 00:00 | | D | 04/09/2013 00:00 | | E | 26/11/2014 00:00 | | F | 24/07/2011 00:00 | | G | 28/05/2014 00:00 | | A | 20/06/2013 00:00 | | B | 04/11/2014 00:00 | | C | 20/06/2013 00:00 | +-------+------

Pivot Multiple Tables with Default Values

让人想犯罪 __ 提交于 2020-01-16 08:36:10
问题 Say I have the following tables (sample DDLs and Insert Statements at end of Post): XX_SAMPLE_ELEMENTS ELEMENT_NAME ELEMENT_ENTRY_ID --------------------------- --------------- Regular Wages 72249260 Workers Compensation 72249256 VERTEX 72249257 ALC Workers Compensation 72249258 US_TAX_VERTEX 72249259 PTO Taken Plan 72523856 XX_ELEMENT_VALUES INPUT_VALUE_ID NAME -------------- ------------------------ 30921 Pay Value 455 Pay Value 391 Pay Value 392 Jurisdiction 235 Rate Code 30921 Pay Value