-8
votes
1answer
57 views

Grouping Row Values Query [closed]

How can I write a query to get the result below from the sample data given? Data in table EMP is as below: Empid Empname Sal Comm 100 ABC Null 20 100 ABC 20000 null Output should be: Empid ...
3
votes
0answers
211 views

Should I group by and then join, or join and then group by?

(oracle's optimizer does the same thing for both approaches when just two tables are involved, thus my question involves three tables) Assume three tables t1, t2 and t3 with a pairwise 1:n ...
1
vote
1answer
346 views

Select Count(*) FROM with-clause-named table order by a, b not working

I have a series of tables defined in a stored procedure to eventually return to the application like this, then culminating to a simple table which contains distinct values from a previously defined ...
3
votes
2answers
385 views

Pivoting data for stacked charts (grouping and creating new columns for each distinct value)?

I have something that looks like this (SQL Fiddle here): Date Location Value 1/1/2012 Baltimore 36 1/1/2012 Houston 36 1/1/2012 Chicago 55 2/1/2012 Baltimore 49 ...