In short: Is there any way to sort the values in a GROUP_CONCAT statement? Query: GROUP_CONCAT((SELECT GROUP_CONCAT(parent.name SEPARATOR " » ") FROM test_competence AS node, test_competence AS parent WHERE...
I’m reading through some old code at work, and have noticed that there are several views with an order by 1 clause. What does this accomplish? Example: Create view...
I’ve a table like: +-----------+-------+------------+ | client_id | views | percentage | +-----------+-------+------------+ | 1 | 6 | 20 | | 1 | 4 | 55 | | 1...
Scenario in short: A table with more than 16 million records [2GB in size]. The higher LIMIT offset with SELECT, the slower the query becomes, when using ORDER BY...
I have a simple SQL query in PostgreSQL 8.3 that grabs a bunch of comments. I provide a sorted list of values to the IN construct in the WHERE...
I want to order by Time,but seems no way to do that ? mysql> show processlist; +--------+-------------+--------------------+------+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+ | Id | User | Host | db | Command | Time...
Is it possible to order when the data is come from many select and union it together? Such as Select id,name,age From Student Where age < 15 Union Select...
I’m stuck on a simple task. I just need to order results coming from this call $results = Project::all(); Where Project is a model. I’ve tried this $results =...
I want to run this query: SELECT DISTINCT ON (address_id) purchases.address_id, purchases.* FROM purchases WHERE purchases.product_id = 1 ORDER BY purchases.purchased_at DESC But I get this error: PG::Error: ERROR:...
There are plenty of similar questions to be found on here but I don’t think that any answer the question adequately. I’ll continue from the current most popular question...