Reputation
28,356
Next tag badge:
95/100 score
23/20 answers
Badges
5 50 93
Newest
 Nice Answer
Impact
~1.2m people reached

44m
comment Create table with select Query on DB link
Where are these attachments you are talking about?
15h
comment Update if exist in other table
Unless your value is NULL, your query should just work.
19h
comment GROUP BY rewrite to subqueries with easily interchangeable AND OR conditions
Why is the GROUP BY used? Having SELECT * and GROUP BY some_column will give you unpredictable and non-sensible results.
1d
comment Can I improve the performance of this MySQL query by adding an index?
I don't see how a full text search will help here. And even if it does, the answer does not provide how the query should be rewritten with MATCH.
1d
revised PostgreSQL Get top-k minimum per range
added 490 characters in body
1d
answered PostgreSQL Get top-k minimum per range
1d
comment PostgreSQL Get top-k minimum per range
I mean, what if there are rows with (1,1,3), (1,1,4), (1,2,3), .... Should the two 3 appear (1 |1 -3| 3 and 1 |1 -3| 3) or one 3 and one 4 (1 |1 -3| 3 and 1 |1 -3| 4)?
1d
comment PostgreSQL Get top-k minimum per range
What should happen if there are ties?
Aug
28
comment Calculating the percentage change from the previous row
It doesn't matter if it's a base table or a query result. Just replace table_name with your query (SELECT ....) and play with the (ORDER BY ...) inside the OVER.
Aug
28
comment Is adding the join columns to a table a good practice to improve performance?
Please add the CREATE TABLE statements in the question and the real column names (I don't suppose you have a column named b2, right?)
Aug
27
revised Scramble the data output of a stored procedure
added 859 characters in body
Aug
27
comment Matching data in two tables
@Vérace , the GROUP BY behaviour of MySQL is well known. It is being corrected in 5.7 version after many years of weirdness. See Why does MySQL add a feature that conflicts with SQL standards? for some explanation and links with more info.
Aug
27
comment Matching data in two tables
@a_horse_with_no_name I agree 100%. I expect Verace to edit - especially since he is suggesting Postgres as a better product, I expect answers to be checked first. Plus the query doesn't really gives us the order_number, as asked in the question.
Aug
27
comment Matching data in two tables
@a_horse_with_no_name but it will succeed if we use GROUP BY c.Cust_ID and 9.1+ ;) sqlfiddle.com/#!15/d1ea41/2
Aug
27
revised Calculating the percentage change from the previous row
added 114 characters in body
Aug
27
answered Calculating the percentage change from the previous row
Aug
27
comment Calculating the percentage change from the previous row
What column should be used for the ordering of rows?
Aug
27
comment Join with comma separated values in SQL Server
The best would be to normalize your tables and not store comma separated values: Is using multiple foreign keys separated by commas wrong, and if so, why?
Aug
27
comment How to recover deleted records by mistake in Mysql
When did the delete happen? Today or a month ago?
Aug
25
comment Unique Index/Constraint with multiple columns, one column is nullable
@Erik yes, SQL-Server has implemented UNIQUE constraints differently regarding this (NULL) aspect (and differently than the SQL standard - which dictates that a NULL in a column bypasses UNIQUE constraints.)