I have a table called SourceTable, in that I have 4 fields. Properties_title field it has got 3 values (AAA,BBB,CCC) but can also have more. Depending on each of them, NumericValue field and Property_item_title field has a value.According to the table in the below, if Properties_title be AAA or CCC so Property_item_title it has value and if Properties_title be BBB
Tag: pivot
Query to “PIVOT” the results of SalesAmount & CumulativeMonthly for specific YEARS
I have a database table that captures every Sales Transaction: Transactions ( ID INT, TransactionDate DATETIME, SalesAmount MONEY ) I need to run a T-SQL query to produce a Sales …
How do i make a sql query using more than one tables with onde condition for each?
i want to get some data from a table but separated by different conditions, for example how many lines have a column are equal to 1, how many have a column equal and the same until the number 5. i did …
SQL join and Bring in 1 column into 2 columns
I have two tables shown as above. I want to create a select statement that would have the following result: Basically, I want to join on ‘Model’ and ‘Num’ columns and bring ‘Val’ vales but break it …
Convert different dates in date column to rows in SQL Server
I want to display different dates as columns from LOGDATE column. Here are the details My query: This query returns this result: Expected output format: I have multiple types of SERVICE_TYPE and SERVICE_NAME, not just the three sown in the sample. How can I get my expected output? Any help would be appreciated. Answer You can do conditional aggregation to
Pivoting SQL table with crosstab function
I made this query that lists all real estate prices per m2 per year in a city. It works nice yet all years end up in rows, with the prices behind them. I would prefer seeing the years in columns with …
is there anyway to display single column data into multiple columns
I tried to do it but it was impossible for me. the solution I need to display single column data into multiple column for the current table only. e.g column [status] 3 records {present,late,absent} to display 3 columns and single row, to prevent 3 rows The result i want to display like this by grouping tid Table structure Answer You
SQL group two value in a same row
I have this query SELECT to_char(timestamp_arr,’Dy DD/MM/YYYY’) as timestamp_date ,to_char(timestamp_arr,’DD/MM/YYYY’) as link_date ,count(transport_uid) as value ,…
Query to generate map table to matrix table
I have 1 map table Group Task —– —– Admin Add Admin Edit Admin Delete Admin View User View I need to generate it in a matrix table like Task Admin User —— —— —— Add …
Need to create a Totals report from oracle table data
I have a table in oracle similar to the the example table image that I need to have output the segregated totals as shown in the second example results image. I need the sums of each item_type where A & B are just examples for a large number of possible items that can be added. example table: example results: Any