Top "Sql-order-by" questions

An ORDER BY clause in SQL specifies that a SQL SELECT statement returns a result set with the rows being sorted by the values of one or more columns.

ORDER BY with columns that are sometimes empty

My SQL looks something like this: SELECT CompanyName , LastName , FirstName FROM ... JOIN ... ORDER BY CompanyName , LastName , FirstName Now the problem …

sql sql-order-by coalesce
SQL ROW_NUMBER gives error

I need to order rows in MySQL and assign a number to each row according to that order. ORDER BY …

mysql sql sql-order-by rank row-number
Applying a different order to postgres "DISTINCT ON" using rails

I have a rails app: user has_many :projects user has_many :tasks, :through => :projects project has_many :tasks …

ruby-on-rails-3 activerecord sql-order-by distinct-on
How to use Order By in a stored procedure without using dynamic SQL

I've the following MS SQL stored procedure. I need to sort the results without using dynamic SQL and sp_executesql …

sql-server tsql sql-order-by dynamic-sql
mysql order by with union doesn't seem to work

Here is my query (SELECT * FROM `jokes` WHERE `flags` < 5 AND (`title` LIKE "%only three doors%" OR `joke` LIKE "%only …

mysql select sql-order-by union
Cast as Int only when Character is a number on FireBird 2.5

I have a query that i use on MySQL database that order the result casting a char database field to …

sql-order-by firebird firebird2.5
ORMLITE ORDER_BY with multiple columns

I am using ormlite in my recent android project. I want to order by on a query on multiple columns …

android sql-order-by ormlite
MySQL specifying exact order with WHERE `id` IN (...)

Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause? Example: SELECT * FROM articles WHERE …

mysql sql-order-by in-clause
10g ordering varchar columns when containing numbers in front

I have an Oracle 10g DB and have a VARCHAR2 (2000 Character) column lets name it TEST which can contain numbers …

oracle sql-order-by varchar2
SQL Server MERGE statement and ORDER BY clause

I would like to write a MERGE statement to pick TOP 10 rows from a large table by using ORDER BY …

sql-server sql-order-by merge-statement