[Solved] SQL Rows into Columns

You cannot achieve this with transpose. rather try using natural full outer join WITH T AS (SELECT P.*, ROW_NUMBER ( ) OVER (PARTITION BY PERSON, LEVELS ORDER BY LANGUAGE) R FROM PROGRAMMER P) SELECT PERSON, SENIOR, MID, JUNIOR FROM (SELECT PERSON, R, LANGUAGE SENIOR FROM T WHERE LEVELS = ‘SENIOR’) NATURAL FULL OUTER JOIN (SELECT … Read more

[Solved] How to select specific value in sas

This answers your first question, but I have a feeling its not what you’re actually after. I’ve also added in a second dataset have2, perhaps you can better explain what you’re after if the data is in that structure. data have; input value1 $ value2 $ value3 $; cards; X1 X2 X3 Y1 Y2 Y3 … Read more

[Solved] Is there a log in SQL Server where I can read what commands have been executed?

Duplicated question (I guess) Looking for a SQL Transaction Log file viewer You can use third party software to read transaction logs. http://www.red-gate.com/products/dba/sql-log-rescue/ http://www.apexsql.com/sql_tools_log.aspx http://www.toadworld.com/products/toad-for-sql-server/w/wiki/10586.log-reader.aspx And if you want to audit truncate command try to audit all commands executed on your database. http://www.databasejournal.com/features/mssql/article.php/3861791/Database-Level-Auditing-with-Microsoft-SQL-Server-2008.htm solved Is there a log in SQL Server where I can read … Read more

[Solved] need sum of value based on category [closed]

What you need is calculating rolling total. The fastest way in SQL Server 2005 / 2008 / 2008 R2 I know is described here: https://stackoverflow.com/a/13744550/1744834. You have to have unique secuential column inside each category to use this method, like this: create table #t (no int, category int, value int, id int, primary key (category, … Read more

[Solved] how to use ‘GROUP BY’ function with below query

Do you mean like this? SELECT * FROM ( SELECT a.id, a.name, c.code, a.active_dt, a.inactive_dt, b.category, COUNT(1) OVER(PARTITION BY a.id, a.name, c.code) AS CNT FROM student a, class b, descrip c WHERE a.id=b.id AND a.id=c.id ) WHERE CNT > 1 0 solved how to use ‘GROUP BY’ function with below query

[Solved] How to get non grouped-by columns in SQL statement (similar to in MySQL)

Below is for BigQuery Standard SQL and as simple as below #standardSQL SELECT ANY_VALUE(first_name) first_name FROM `project.dataset.table` GROUP BY age As you can see you were missing just aggregation function – it can be any – MAX, MIN, etc. I’ve chosen ANY_VALUE as an example You can test, play with above using some simplified dummy … Read more

[Solved] How to select highest paid employee in dept based on the following? [closed]

If you are using SQL-Server, use ROW_NUMBER or DENSE_RANK(if you want to include ties): WITH CTE AS( SELECT e.EmpID,e.EmpName,e.EmpSalary, e.Department,b.EmpBonus, RN = ROW_NUMBER() OVER (PARTITION BY Department ORDER BY (EmpSalary + COALESCE(EmpBonus,0)) DESC) FROM Employees e LEFT OUTER JOIN Bonuses b ON e.EmpID = b.EmpID ) SELECT EmpID, EmpName, EmpSalary, Department, EmpBonus FROM CTE WHERE … Read more

[Solved] how to get result based on 10 minutes interval in mysql

i have found the solution by below query. select a.time_column,group_concat(a.destination order by ct desc) from (select case when time between ’00:00:00′ and ’00:10:00′ then ’00:10:00′ when time between ’00:10:01′ and ’00:20:00′ then ’00:20:00′ when time between ’00:20:01′ and ’00:30:00′ then ’00:30:00′ else ’00:00:00′ end as time_column , destination , count(destination) ct from click group by … Read more

[Solved] Undefined offset:1, 2 3 etc

$csv_array[1];, $csv_array[2]; and $csv_array[3]; don’t exists inside your $csv_array. As suggested, do a var_dump($csv_array) below $csv_array = explode(“,”, $csv_data[$i]); and see what is in there! 0 solved Undefined offset:1, 2 3 etc

[Solved] How to query in Oracle [closed]

here is how you could go about the two tasks: Query HOLDEVENT twice, so you get records with an event, an organizing club and another organizing club. Think of a way not to get both event = “Event 1” | club1 = “Club A” | club2 = “Club B” and event = “Event 1” | … Read more