What if I don't have a column I can use as an aggregate function in my T-SQL PIVOT?
As seen here: http://www.tsqltutorials.com/pivot.php What if I don't have a column I can perform a SUM upon? How do I get a pivot'ed table result? Thanks, Matt. ...
As seen here: http://www.tsqltutorials.com/pivot.php What if I don't have a column I can perform a SUM upon? How do I get a pivot'ed table result? Thanks, Matt. ...
How do I get this: entityid name stringvalue ----------- -------------------- -------------------- 1 ShortDescription Coal 1 LongDescription BlackCoal 1 ShortDescription Gold 1 LongDescription WhiteGold 1 ShortDescription Steel 1 LongDes...
Sorry for an unclear question previously; hopefully I can start again... I have this data: entityid name stringvalue ----------- -------------------- -------------------- 1 ShortDescription Coal 1 LongDescription BlackCoal 1 ShortDescription Gold 1 LongDescription ...
Hello, I do not want to use 3rd party controls because I would have to buy a suite for justing using one control... So is there any chance I can arrange 3 entities: Subject, Grade and Pupil in that way on a simple DataGrid to show Pivot data like: ...........Math....Sports.... M.Kramer...A.......C......... B.Jonson...D.......A........
I have a simple query over a table, which returns results like the following: id id_type id_ref 2702 5 31 2702 16 14 2702 17 3 2702 40 1 2703 23 4 2703 23 5 2703 34 6 2704 1 14 And I would like to merge the results into a single row, for instance: id concatenation 2702...
I have developed code which identifies the multiple item selections from a Pivot field and writes the list of items to a table. I then wish to take this contents of the list and use it to populate a number of other Pivot Tables on other tabs. I currently have the ability to do this for single Pivot items selections, but I need to do th...
I'm trying to do a lookup on our demographioc table to display some stats. However, since out demographic table is quit big I want to do it in one query. There are 2 fields that are important: sex, last_login I want to be able to get the total number of logins for various date ranges (<1day ago, 1-7 days ago, 7-30 days ago, etc) GROUPE...
Hi, I have looked into pivot but I think it requires an aggregate function which I do not need (I think). The result of my query is this Name Property Name PropertyValue ---------- ---------- ---------- lorem Work Phone 000.111.2020 ipsum Email tes...
I have table similar to the following: Year | Product | Value 2006 A 10 2006 B 20 2006 C 30 2007 A 40 2007 B 50 2007 C 60 I would like a query that would return the following comparison Product | 2006 Value | 2007 Value A 10 40 B 20 ...
Can we do matrix transpose (rows become columns and columns become rows) in standard SQL2005/2008? 1 2 3 4 5 4 5 6 6 7 7 8 9 8 9 1 3 4 5 6 2 4 5 6 7 changes to 1 4 7 1 2 2 5 8 3 4 3 6 9 5 6 4 6 8 5 6 5 7 9 6 7 how about no of rows <> no of column ? let's consider the no of rows it's fixed. ...
Maybe I demand too much from SQL but I feel like this should be possible. I start with a list of key-value pairs, like this: '0:First, 1:Second, 2:Third, 3:Fourth' etc. I can split this up pretty easily with a two-step parse that gets me a table like: EntryNumber PairNumber Item 0 0 0 1 0 ...
I have a table of over 1 million test score records that basically have a unique score_ID, a subject_ID and a score given by a person. The score range for most subjects is 0-3, but some have a range of 0-4. There are about 25 possible subjects. I need to produce a score distribution report which looks like: subject_ID 0 1 2...
I have tables like: 'profile_values' userID | fid | value -------+---------+------- 1 | 3 | [email protected] 1 | 45 | 203-234-2345 3 | 3 | [email protected] 1 | 45 | 123-456-7890 And: 'users' userID | name -------+------- 1 | joe 2 | jane 3 | jake I want...
I have a generic datamodel with 3 tables CREATE TABLE Properties ( propertyId int(11) NOT NULL AUTO_INCREMENT, name varchar(80) NOT NULL ) CREATE TABLE Customers ( customerId int(11) NOT NULL AUTO_INCREMENT, customerName varchar(80) NOT NULL ) CREATE TABLE PropertyValues ( propertyId int(11) NOT NULL, customerId int(11) NOT...
I hope someone can help me out. I have a table that logs our import jobs. I need a query that will produce a matrix with the names of tables on the vertical axis, the import dates on the horizontal axis, and the total number of records imported for that table on that date in the matrix cell. I don't care if we have to create a temporary ...
I want to return the top three pets for each employee as columns instead of rows i.e. Owner_ID Pet -------------------- 1 Cat 1 Dog 1 Hamster 2 Cow 2 Sheep 3 Dog Convert it to Owner_ID Pet1 Pet2 Pet3 ------------------------------------- 1 Cat Dog Hamster ...
I have a Sql Database table similar to the following: Day Period Subject Mon 1 Ch Mon 2 Ph Mon 3 Mth Mon 4 CS Mon 5 Lab1 Mon 6 Lab2 Mon 7 Lab3 Tue 1 Ph Tue 2 Ele Tue 3 Hu Tue 4 Ph Tue 5 En Tue 6 CS2 Tue...
Hi, i have a details table with columns: user_id int code int value int And i want to build a summary table that looks like: user_id int valueA int valueB int In the details table, valueA would correspond to say, code 5, and valueB would correspond to say, code 6, so i'm looking for something like: insert into summary (user_id,v...
Dear All, Any idea about how to embed/insert pivotTable/pivotChart in a userForm? *code sample will be great to share. 1000,000 thanks in advance ...
Hello, Been trying to put together an SQL query that sorts data into financial years (which I've sorted) and then SUMs it according to each distinct value in the claim_id column table structure is: claim(id, claim_id, date, amount) SQL so far is: SELECT CASE WHEN MONTH(date)>=4 THEN concat(YEAR(date), '-',YEA...