Most voted "select" questions
USE THIS TAG ONLY WHEN REFERRING TO DATABASE. SELECT is an SQL statement that returns zero or more rows, from one or more base tables, temporary tables, or views in a database. DO NOT USE to refer to the HTML "select" element, in which case use [html-select].
Learn more…807 questions
Sort by count of
-
0
votes0
answers21
viewsSlow MYSQL query, when searching for date
I’m doing a date search on mysql, but it gets very slow (more than half a second). Is there any way to optimize this search to get faster? Ex: of consultation: SELECT dt.data,count(d.id) AS…
-
0
votes2
answers156
viewsBirthday Ordering - SQL Server
Good night! I have an SQL Server Database with fields: Name and Birth Date. I must sort by the Birth Date, being the order of the nearest date to the most distant date, the intention in this order…
-
0
votes1
answer30
viewsSelect Chained between two tables using criterion the field of the first
Good afternoon, great masters. Here’s the situation, I need to get you out d12400 all field results nrentg in which the field dtentg be = '13.10.2020', to search in the table d12410 the fields that…
-
0
votes1
answer166
viewsCount in multiple tables
I have 3 tables I need a query that takes the name of the school, number of classes type A, Qtde of classes type B, Qtde of students who are in classes type A, and Qtde of students who are in…
-
0
votes2
answers32
viewsHow to rename an input from a selector?
I would like to know which script is able to rename an input by choosing a selector. My input name is THUMB, if the person marks the first option, but I would need the input name to change if I…
-
0
votes1
answer40
viewsHow to individualize database queries with PHP?
Hello, good morning. I have the following problem: I want to handle SQL output using PHP, displaying the values individually and custom. For example, I have a database with the values Tomate |…
-
0
votes1
answer31
viewsHow to delete rows in three tables with specific condition (SQL)
Hello. I need to delete the contents of a select that collects rows of three tables, which has columns with common values but which are based on parameters of a single table to exclude. select *…
-
0
votes0
answers28
viewsI want to make a select in my database to see all the results that are: status = 1
$sql = "SELECT * FROM pagamentos WHERE status = 0"; while($aux = mysql_fetch_row($sql)) { echo '<td>'. $aux['nome_cliente'] .'</td>'; } …
-
0
votes1
answer52
viewsI do not receive SELECT FROM data
I’m making a simple login system but I never get a real line where $sql = "SELECT * FROM $this->table WHERE 'email' = :email AND 'senha' = :senha"; But the email and password are correct, PHP…
-
0
votes1
answer26
viewsCONCAT WITH ERROR
SELECT b.numero_contrato as name, CONCAT( sum(CASE WHEN a.status = 'Concluida' THEN 1 ELSE 0 END) AS concluidas, sum(CASE WHEN a.status = 'Recebida' THEN 1 ELSE 0 END) AS recebidas, sum(CASE WHEN…
-
0
votes1
answer43
viewsSelect only returns result in terminal
I’m having trouble understanding why the code below only returns result when executed in the terminal. I intend to return hash of the last id entered in the database connection =…
-
0
votes1
answer28
viewsCreate a select within another select to select the top ten values of each month
I’m trying to get the 10 best values of each month, I’ve looked for article here, but none helped me so far, I tried to do several subquery, but it was almost the same thing to take table 1 and…
-
0
votes0
answers5
viewsBring ENADE - R microdata specific columns
Good afternoon, I’m trying to bring up some columns of data from a microdata file from ENADE. microdata_enade <- read.table("C:/MICRODADOS_ENADE_2017.txt",header = TRUE, Sep=";", Dec = "." ,…
selectasked 3 years, 5 months ago ROSANA DE ALMEIDA NASCIMENTO 1 -
0
votes1
answer129
viewsWhy isn’t my consultation working?
I have a query in a table that should return the amount of records found that meet a certain requirement. The code: <?php require('conn.php'); $prevJan= "SELECT COUNT(ID) AS PrevJan FROM…
-
0
votes1
answer961
viewsHighchart chart importing table values from the database
I have a system where students are enrolled in training classes, every enrolled student is "scheduled" to attend and when he attends, in addition to scheduled he "held". What I want is to make a…
-
0
votes1
answer2354
viewsPHP - MODAL window
I have tried some scripts but unsuccessfully, I ask for forgiveness if you have in any forum already, but I looked for the modal and nothing supplied my need, there goes: I have a modal inside the…
-
0
votes0
answers96
viewsMake two or more Select with Aliases in the query to generate a separate array
I have a single column table with all the words in English. I want to do a double or triple Select and recover in each query all words with 'A' in alias Palavrascoma, and all with 'B' in Alias…
-
0
votes1
answer1410
viewsI need an item from my select to be selected, Angular
I have a select component <div class="form-group col-md-4"> <label>Entidade:</label> <select ng-model="distrito.entidade.idEntidade" class="form-control"> <option…
-
0
votes1
answer82
viewsMerge the results of two SQL’s commands into H2
I created the following Query: SELECT s FROM SuprimentosPedidos s WHERE s.codigoModeloImpressora = :codigoModeloImpressora AND s.codigoEmpresa = :codigoEmpresa and s.prioridadeSaida = 1 ORDER BY…
-
0
votes0
answers51
viewsSQL does not return all table records
My application consists of an html page in which the user informs the code of a product, the quantity, and it is shown below. Behold, if I add a product, it is inserted but does not return. And when…
-
0
votes1
answer8478
viewsSelect most recent record from a given table - Postgresql
I need to select the most recent record of my Estoque case the column data be different, I managed as follows to bring the oldest when the dates are different: SELECT codigosuprimento, numeroserie,…
-
0
votes1
answer50
viewsReturn datatable of select
I’m using the datatable with ajax, getting among others a column with select, but I don’t know why onchange does not work. Follow the return of ajax: {"data": [[ 1, "17020161", "Marina Costa…
-
0
votes2
answers859
viewsFill inputs dynamically after change in select
Good afternoon, I need help with a part of the code. I basically have a form with two selects(aluno_id, product name) and some inputs(price, quantity, total price), I use functions to fill arrays…
-
0
votes2
answers246
viewsI need to select recipes and their ingredients, without repeating the other recipe fields
I have the following scenario: Revenue Table --------------------- id name method of preparation category Ingredient Table -------------------------- id name Table Ingrediente_recipe…
-
0
votes2
answers120
viewsRemove repetitions in select Oracle sequence
I have a question to mount a query on Oracle, I have the following so far... SELECT M5.NIVEL_ESTRUTURA , M5.GRUPO_ESTRUTURA , M5.SUBGRU_ESTRUTURA , M5.ITEM_ESTRUTURA , M5.SEQ_OPERACAO ,…
-
0
votes2
answers84
viewsHow to work the return of a select max query?
I will be brief: When trying to work the values of a query that uses MAX, I get the error: Use of Undefined Constant protocol - assumed 'field name'. Table: Select: $atestados = $conect -> query(…
-
0
votes1
answer37
viewsError in selection query about social network requests
Hello, in my project I need to list the people and requests received by the user, but when listing people, I need to list only those who did not submit or that the user did not submit requests, in…
-
0
votes2
answers43
viewsselect search in database with repeated records
I’m making a select in my bank, whatever, Postgres, and more records are coming.. For example, id_pessoa comes a 10 more record than should come.. SELECT pac.cns, pac.cns_responsavel,…
-
0
votes1
answer468
viewsUndefined when passing parameter to a JS and Angular function
I have a function that receives as a parameter a value coming from HTML, however, it is coming undefined. I’m using JS and Angular. My HTML <div class="input-group col-lg-3 col-md-3 col-sm-3…
-
0
votes1
answer920
viewsIt takes a long time to query in mysql
Hello friends I’m having a hard time finding what is wrong in my selection code (SELECT) in mysql, this taking more than 70sec do not know why. Someone there to help me please? Code: SELECT…
-
0
votes3
answers156
viewsCondition in a select
I need to create a SELECT which contain only records of a value x onwards. For example, return only movies with number of copies greater than 5 My Select router.get('/filmes', (req, res) =>{…
-
0
votes1
answer372
viewsCreate select for a PHP table
I’m having trouble creating the select to later use in a table. The mandatory SQL tables are the following: “Aluno” (**PK:** id, numero, nome), “Area” (**PK:** id, nome), “UC” (**PK:** id, nome,…
-
0
votes2
answers1008
viewsReturning select value with javascript/jquery
I am developing a software and I need to know which option the user selected and return in the console.log, but I have tried several functions and none worked. How do I get that return? function…
-
0
votes1
answer43
viewsdoubts with Mysql somatorio
I have the following tables the contamov table, may have several low of the same record of the crecpa table. need Select records from the crecpa table and the sum of the low (value field) of each…
-
0
votes2
answers719
viewsBring repeat records from 3 columns in the same table
I have a table with transport voucher data of my company employees: nome ! valor1 ! valor2 ! valor3 teste1 ! 6.50 ! 0.00 ! 0.00 teste2 ! 4.30 ! 2.80 ! 1.10 teste3 ! 8.40 ! 1.10 ! 0.00 teste4 ! 2.85…
-
0
votes0
answers48
viewsCombobox checking whether it is already selected or not
Good afternoon I need help making a checkbox with the following function: if a value of the checkbox is already inserted it is red, and if any value is not inserted it is green. So the following is…
-
0
votes3
answers103
viewsGet the same result from a query with Join
I have researched on some forums, consulted my books and looked in other sources, but I did not find anything to solve my problem. I have a query that queries the open value in a given table: select…
-
0
votes4
answers534
viewsHelp with distinct
I have the following sql query: select nome, data, situacao from cadastro The result is like this: MARIA 01/01/2018 0 MARIA 15/01/2018 1 GISELE 15/01/2018 0 CICERA 08/01/2018 1 ANTONIA 20/01/2018 0…
-
0
votes1
answer635
viewsFilter problem using class="selectpicker" in filter select,
Good afternoon, could anyone help me with this problem? I have no idea what’s going on.... Next, I have a select that selects the city, and then the following as selected the city, so far so good,…
-
0
votes2
answers410
viewsHow to merge these 2 SELECT into a single query
Good morning, I’m redoing the question because the last one I deleted was a little confused. I have these two select and would like to join them to return the result to a comparison chart. This…
-
0
votes1
answer225
viewsHow to validate higher value received in mysql?
I have a query that returns the last accesses of the users in the system. I would like to know how I could treat to return only those dates that are longer than 15 days. This is the consultation:…
-
0
votes1
answer667
viewsPopular select from countries and states with php mysql ajax
I have 2 selects: #parents and #status. I want that when selecting the country, it populates the state only with the states of that country, which are written in a mysql table: tabela_paises id|pais…
-
0
votes1
answer21
viewsHelp with SQL query
I have 3 tables: enterprise: id integer nome string category: id integer idEmpresa integer nome string tag: id integer idEmpresa integer nome string I am consulting as follows: SELECT…
-
0
votes2
answers512
viewsSelect/Where with parameter does not work on Oracle
I am making a select with Where via PHP and Oracle, when it receives an error by the parameter occurs: Warning: oci_execute(): ORA-00911: invalid Character in C: xampp htdocs project includes…
-
0
votes0
answers50
viewsBring the value of one column according to the condition of another
I am developing a simple script but I came across a situation that I am not able to solve it, I tried through CASE but without success. With a simple select I need to bring the columns Name, RG,…
-
0
votes1
answer113
viewsSelect from all users with only one result from each user
Hey, good night, man. I think the title is a little fuzzy, I’ll try to explain better. I’m making a chat system and I want to list all user conversations, but only one message from each user.…
-
0
votes0
answers630
viewsINNER JOIN with a SELECT TOP
When generating a script, I tried to modify a Where for Inner Join. However, the time when running with Inner Join was more than 10 minutes and with Where, it was in a matter of seconds, as the…
-
0
votes1
answer20
viewsSQL query with OR gets slow
I have an appointment that does the search using: WHERE pt.product_name LIKE '%termo da busca%' Then I want the search also look for the artist’s name and put: WHERE pt.product_name LIKE '%termo da…
-
0
votes1
answer130
viewsPercentage in SQL
I have the following consultation code: SELECT AC.DT_AGENDA AS DATA, ME.DS_MULTI_EMPRESA AS EMPRESA, AC.CD_UNIDADE_ATENDIMENTO AS CD_UNID_ATENDIMENTO, UA.DS_UNIDADE_ATENDIMENTO AS…
-
0
votes1
answer376
views<select> calling either a text field or another select
Guilherme Costamilam mto thanks for the answers. I don’t know where I’m going wrong in the code. I’m going to see if you can help me. <!DOCTYPE html> <html lang="pt-br"> <head>…