Questions tagged as 'sql-select'

4
answers

How to get values separated by "BR" in MySQL?

The idea is simple ... I need to get values from a table (by doing SELECT) that are separated by <BR> from a STRING field and then storing a record in a table, inserting each separation. Example 1: Registration: "Enviado...
asked by 13.03.2014 / 19:58
1
answer

Get values that were not used inside bd

I have a table with multiple product codes: EX: 1, 2, 3, 4, 5, 15, 20, 21, 22, 45, 60 ... 100 Would you like to know if there is any query to pick up the codes that have not yet been used in the records? In the above example code 5 jump to...
asked by 25.09.2014 / 16:08
1
answer

Select a list of values and from this list, select the lowest value

I want to select the last 10 inserts of a table and among those 10, return the lowest value. Is it possible to do this in a single query? Selecting the last 10 values: SELECT id_relevo FROM relevo ORDER BY id_relevo DESC LIMIT 10     
asked by 23.09.2018 / 03:30
1
answer

Select difficult with date [closed]

I can not do this: how do I return the time in minutes or hours that a particular VALUE occurred in the table below? Example: How long has the VALUE greater than "23" occurred on 05/05/2017? and if you have interval between records? for ex...
asked by 28.07.2017 / 02:39
4
answers

Return value in SQL Server query

I need this query to return 2 instead of A. TYPEUSUARY is of type varchar. Can someone tell me where the error is? USE DATABASE SELECT TIPOUSUARIO FROM TABLE UP (NOLOCK) WHERE TIPOUSUARIO = case TIPOU...
asked by 21.10.2016 / 14:21
1
answer

How to make ORDER BY with information that may vary?

I'm getting a list of articles from a database and I want to have on page one tool that allows me to list them by date order that were written or in alphabetical order. Here I have my bank reading function: $sel = DBRead('artigos', null ,'*...
asked by 03.09.2014 / 00:03
1
answer

Select with Search Terms

I need to make an query where I only display results in one condition: # Search the Database $select_sql = "SELECT * FROM users WHERE user LIKE :search OR date_access LIKE :search OR ip LIKE :search AND active LIKE :active ORDER BY id DESC"; $...
asked by 14.09.2016 / 21:49
2
answers

MySql Subquery

I have an employee table that has only three columns, NOME , CARGO and SALARIO , I want to set up a query that brings me this whole table and contains the highest salary value for the job. Totalizing 4 Columns ( NOME ,...
asked by 15.05.2014 / 16:59
2
answers

How to give a select and bring the top 1 of each group?

I have a table of processes. That is, each time a process is run, it generates a new row. I want to give a select bringing the last execution of each process. Here is an example: Id|ProcessoNome|Situação|DataInicio 1 |RPA_001 |suces...
asked by 04.10.2018 / 21:56
1
answer

GROUP BY - Display grouped result using WHERE as condition in same table - MySQL

I'm trying to set up a query to fetch results in a table where I need to determine a condition for one column, group for another, and display a third. The database is composed of 6 tables, 5 of which are queried individually, containing: i...
asked by 04.01.2017 / 00:08