Most voted "order-by" questions
66 questions
Sort by count of
-
0
votes1
answer46
viewsQuery zeroing column when applying order by - Mysql
I am with a query that when ordering it in ASC it Zera a column of my table, but if I sort in DESC displays the values normally. This is the query: SELECT `tab_medicamentos`.`id`,…
-
0
votes1
answer573
viewsMysql SELECT with ORDER BY no GROUP BY
I have a table called contacts, all contacts made on the site are registered on it. There is also a table called status, where the service status of each is stored contact. The question, I need to…
-
0
votes1
answer84
viewsSort by custom Fields and by publication date
My problem is this, I have a post_type in the name of "collections" and within it several posts with custom fields "situation of the piece" and "collection of the piece". The result of these two…
-
0
votes1
answer41
viewsHow to insert a keyword into a database search already performed
For example, I did a search of all user data in the database to echo in different columns by the site: $stmt = $conexao->prepare("SELECT * FROM esc_usuarios WHERE usu_codigo = ?");…
-
0
votes1
answer146
viewsORDER BY in php with paging ordering only the first page
I wrote the following code in php, I would like it to show the items in order according to the form combobox, but in it it sorts only the first page’s items. Thank you! <html lang="pt-br">…
order-byasked 6 years, 1 month ago Leonardo Hernandez 1 -
0
votes1
answer102
viewsMysql order by hour
In Mysql I have the following table: 2018-06-28 12:10:26 2018-06-25 11:10:26 2018-06-21 14:10:26 2018-06-31 00:10:26 2018-07-28 01:10:26 2018-07-29 09:10:26 Are the login days of each user (have the…
-
0
votes1
answer64
viewsDetermine display order of ordered queries in MYSQL
I have three types of orders in the table and need to get the result so I choose who will index first. I specify the respective indexing order: ( ORDEM_COMUM IN FIRST ) ordem_comum,…
-
0
votes2
answers44
viewsChoose the order in which items are listed in Mysql
I have a table with three types of order, ordem1, ordem2 and ordem_especial . How can I list items in that order: EXAMPLE: ordem2 ordem_especial ordem1 I tried unsuccessfully something like : REAL…
-
0
votes1
answer44
viewsQuery MYSQL does not order correctly
Hello. I have the following query: SELECT * from usuarios_cursos_matriculados LEFT JOIN cursos ON cursos.cedoc_doc_id_fk = usuarios_cursos_matriculados.cedoc_doc_id_fk LEFT JOIN cedoc_doc ON…
-
0
votes0
answers22
viewsSolution for an error in MYSQL
Guys, could help me I’m trying to create a view "POSICAO_EQUIPES", with a Query that displays the overall classification by Teams, regardless of category. The query should display the Championship…
-
0
votes0
answers27
viewsOptimize Mysql query with Sub Select
I was having a problem of slowness in a select as below: select vendas.codigo, vendas.cartao_tipo, vendas.valor, vendas.datavenda, venda.autorizacao, cliente.codigo, cliente.nome, cliente.cpf,…
-
-1
votes1
answer71
viewsHow to order query in MYSQL by relevance? (first results that the term is in the title, then in the content)
I have a table as follows: id|nota|titulo |ingredientes 1 | 3 |pão de batata|batata;farinha;agua;ovo 2 | 2 |bacalhoada |bacalhau;batata;pimentão 3 | 1 |batata frita |batata When I do a search that…
-
-1
votes1
answer79
viewsReturn of several CASE in a single line
How do I convert that return: In a single line: 548721 125 2 20836 20836 77821 77821 9999******9999 0 0 MASTERCARD 200 Cartao de Credito a Vista My query: SELECT CASE data_id WHEN 17 THEN data_value…
-
-3
votes1
answer50
views.Orderby() Does not order correctly - Aspnet Core
In an Aspnet Core 2.2 application, I had the following code that selected the field of a table and instructed to sort by Text: Controller: //Bairros ViewBag.Bairros = _context.Imoveis.Select(c =>…
-
-3
votes1
answer56
viewsHOW TO ORDER BY COLUMN NICKNAME
Good morning Everyone, I’m trying to give a Order By by the column of a case nicknamed PROVISION but it won’t. SELECT CODIGO, PRODUTO, VENDIDO, ESTOQUE, PERIODO || ' DIAS' AS PERIODO, (CASE WHEN…
-
-5
votes1
answer60
viewsI NEED HELP ORDERING A QUERY
I’m doing a query where I’m returning the last record of the day(which in case has the days but there are several time records in a day, and I’m picking the last of them in a sub select), the…