Questions tagged as 'order-by'

1
answer

Order By with List

Is it possible to make a OrderBy in a List<> setting the value for comparison? Example: mRel.OrderBy(s => s.Status == EnumModel.StatusGeral.Novo).ToList() My Code: List<MotivosModel.MotivosRel> mRel = Carre...
asked by 04.05.2017 / 17:43
1
answer

ORDER BY only day without time

In MySQL I have a column timestamp called dia_cadastr o (2016-06-21 11:27:32), in the query I want to give a ORDER BY only on the day, and disregard the time. That is, if they have products registered the same day, then it g...
asked by 24.06.2016 / 15:07
1
answer

MySQL sort too slow for results with many records

I have two tables, the first one is used to group the data of the second with some information about the set, in order to facilitate the pagination of the contents. Table 1: - id INT(11) NOT NULL UNSIGNED AUTO_INCRE...
asked by 30.04.2016 / 02:12
1
answer

Combination of 4 numbers in MySQL

DBMS: MySql Problem: List all the possibilities of combinations between the numbers "1,2,3,4", so that they do not repeat between them. Example: 1 2 3 4 12 13 14 21 23 24 31 32 34 41 42 43...     
asked by 22.04.2014 / 21:02
1
answer

How to filter separated dates by day, month and year in MySQL

Hello, I have a table "Meetings" in MySQL with the following structure:    id: Int (11), subject: String (40), day: String (2), month: String (2),   year: String (4), active: String (2) Save in the field day the day of the meeting, mes th...
asked by 23.03.2016 / 04:22
2
answers

Sort month that is in extensions in Postgres

I need to make a ORDER BY in a table mes that has the months in extenso and in Portuguese (Janeiro, Fevereiro...) . It has no relation to any other column in the table. Is it possible to do this?     
asked by 20.05.2015 / 15:57
1
answer

Error when using Group by in a VIEW in Mysql

I created a VIEW to return the main data I need in a single query. CREATE ALGORITHM = UNDEFINED DEFINER = 'root'@'localhost' SQL SECURITY DEFINER VIEW v_historicoProcesso AS SELECT p.protocolo AS protocolo ,p.der AS der ,p.dat...
asked by 05.12.2015 / 23:18
1
answer

Query gets slow with ORDER BY

I have a problem, I have a query and when I use ORDER BY it gets very slow.    Note: I created an index for the premium field and another index for the score Follow the complete query: SELECT p.id AS id_freelancer, p.nom...
asked by 11.04.2014 / 22:35
1
answer

Randomized query in ascending order in MYSQL

I have a table where I have the student's name and punctuation, I need to pick up 5 random students and display them in ascending order of punctuation. I tried to do this, but he's just bringing students randomly and not ordering the score:...
asked by 27.01.2016 / 15:30
1
answer

Get the last message of a conversation (GROUP BY)

I have the following query: SELECT cp_mensagem.mensagem, cp_mensagem.dh_envio, cp_projeto.id as id_projeto, cp_projeto.nome as nome_projeto, cp_pessoa.id as id_freelancer, cp_pessoa.nome as nome_freelancer FROM c...
asked by 25.04.2014 / 17:58