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
votes1
answer221
viewsHow to Subtract MYSQL
How to do the correct subtraction of these two columns in the SQL script? SELECT DISTINCT b.prefixo as idVeiculo, max(datatroca) as datatroca, max(kmtroca) as kmtroca, max(horimetroca) as…
-
0
votes3
answers399
viewsHow to select the last rows added in a mysql table
I have the following table sir_ter_conversa which is a conversation history. id|idterreno|idincorporadora|idusuario|msg|data 1 | 1 | 771 | 771 | a |2018-05-27 10:20:00 2 | 1 | 771 | 773 | b…
-
0
votes0
answers109
viewsHow to make select mandatory? and also select by default the first available option?
I have a system in php that generates selects according to the database information, in case I would like to make these selects mandatory because if they do not go unnoticed and also always leave…
-
0
votes1
answer247
viewsQuery Mysql with 3 tables
I have the following query that should bring the sum of views and last view (table sir_ter_relatorios_terrenos), sum of favourites (table sir_ter_favoritos) and the person’s name (table sir_users)…
-
0
votes2
answers66
viewsWhat’s wrong with this query?
Okay, I’m trying to select a database through ajax using jQuery. Below are excerpts of the code I’m using and more explanations: Ajax function function carregaRegistros(dia, mes, ano) { dia =…
-
0
votes4
answers91
viewsSelect with columns stating incorrect data
Hello I’m having another problem with a database search. I want to make a SELECT that looks for information such as Cod.empresa, razaosocial, ano e valores(somados). At first, the search for…
-
0
votes1
answer327
viewsUsing Select android studio
I was able to save information in my Sqlite bank, only I can’t call them. I’m trying to use the following method: private void verPessoas() { ArrayList<RespostasAguaCasa> pessoas = new…
-
0
votes1
answer293
viewsSelect com group by duplo
In Mysql I have a table called contact_status: id | id_contato | detalhamento_id 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 2 | 2 5 | 2 | 1 6 | 3 | 2 7 | 4 | 4 8 | 5 | 4 In it is recorded all the contacts of…
-
0
votes1
answer46
viewsError in select search
I can’t return the value inside my Arry always returns 0 Read public class Read { public ArrayList<RespostasAguaCasa> getLista() { SQLiteDatabase db =…
-
0
votes3
answers1387
viewsHow to use checkbox group to search with php and mysql
I’m developing an immovable site with a search, where one of the filters is the neighborhood. Currently it is a Dropbox, but I would like to swap by checkbox group to be able to select more than 1…
-
0
votes1
answer142
viewsHow to use Laravel Pagination with queries in raw DB::select() format
To get some database information at times it is simpler to make a querie with raw sql than to use multiple models, maps functions and a magic touch to reach the same goal, however the problem of…
-
0
votes2
answers901
viewsHow to use Multiple select in PHP form to query in MYSQL
I have a search with a select that can select more than one option, but I don’t know how to make them search all the selected options. Currently it does the search, inserts the values in the url (I…
-
0
votes1
answer68
viewsHelp with Join in Mysql
I found several questions/answers about John on the site, but I still can’t create the command I need. What I need is the following: I have the following tables: item (I have two entries) id…
-
0
votes1
answer271
viewsCan you create a rule in MYSQL to divide the value of one column by another?
I want to know the average of the values (value m2) in a table using AVG() (or otherwise). I have a table in MYSQL with the columns id, total value (Total value), value m2 (Value per m²) and area.…
-
0
votes1
answer80
viewsChange Javascript iterative select background color
Hey, you guys. I’m having a hard time changing the background color of multiple selects iteratively. I can already change, but I have to manually specify the element index for this to happen. Here’s…
-
0
votes1
answer21
viewsHow to pull the Option value from the select HTML property that is saved in MYSQL
How do I change and be saved in the database, once I update the saved value is filled in the box, the way I am doing saved in the bank, but when updating the page it always leaves the box filled…
-
0
votes0
answers112
viewsHow to update a <select> with data from another <select>
I would like to know how to update a select with data from another. I currently use SQL, I already have a connection created: $connection = new COM("ADODB.Connection"); //instancia a classe de…
-
0
votes0
answers189
viewsHow to display the result of a search in mysql where returns more than 10mil result without crashing the browser?
I am currently using the table jquery to display the results, but it takes a long time to display all the results and while the search is not finished the browser sometimes hangs. has some better…
-
0
votes2
answers399
viewsHow to make a @foreach with Relationship Tables in Laravel
I’m using Laravel freamwork where in my database I have 2 tables: -> complainants (with the field 'id','complainant','typoacoes_id') -> typos (with id fields, 'name') Both are already with the…
-
0
votes1
answer142
viewsCumulative count per month
I’m having difficulty making a cumulative count in mysql. I need to count the amount of active registration accumulated in each month. Table: id | data_cadastro | data_exclusao…
-
0
votes1
answer53
viewsAngularjs and Image Picker - I can’t capture selector content
I am with the following doubt: If I click on the selector (in the box), I can capture the content of ng-model "firstJogo" and manipulate it in javascript as needed: <p>Escolha o jogo</p>…
-
0
votes1
answer46
viewsLink in computer table that submits a field to a plug
Good morning, you guys, I have a table, which is a query select of the data of the devices I control. In it I have several elements, such as Name, Macaddress and IP, for example. In the IP column, I…
-
0
votes2
answers48
viewsPerform multiple operations in a single SQL code
I have a table in Mysql as follows and structure: I would like to run an SQL query that does the following operations: Total number of records (total1); Count how many records have id_nps_answer…
-
0
votes2
answers158
viewsSum of fields completed within the SELECT itself
I have an SQL query in the following format: SELECT XXXX AS duracao, calcula_horas_manutencao({data_inicio_f}, {data_final}, contrato.id) as horas_manutencao,…
-
0
votes2
answers683
viewsIs it possible to use Inner Join in several columns of the same table in a Select?
In the database there are 2 related tables. Collaborators: Events (here makes the input of training time by collaborator): I need to know the total training time of each sector. Select below works,…
-
0
votes0
answers62
viewsHow to take variable script and insert into a php database?
I have a select field according to the code below: <select id="teste"> <option>oie</option> <option>tchau</option> I have a knob to run an Insert in the database…
-
0
votes1
answer30
viewsHelp with logic UPDATE using queries
It’s the following guys, I have two tables, the table esc_usuarios which contains information from registered users and esc_usuarios_slog, that contains the records of the casualties, in which they…
-
0
votes1
answer177
viewsEnable select by selecting with jQuery
I conducted a cursory research on enabling a select when choosing an option in another select, but I couldn’t find anything that applied. $(document).ready(function() {…
-
0
votes1
answer56
viewsSELECT TO REDUCE SEVERAL SIMILAR MYSQL ENTRIES
Good morning guys, I have searched and found nothing very useful. I have an inventory database of my Network Stations. The agent installed on each station sends the installed program names to the…
-
0
votes2
answers100
viewsSelect with reference in several tables
I have three tables: PRODUTOS, PEDIDO and ESTOQUE, and I want to list all the stock by order and by products, as shown below: products codigo tipo medida 3020 | unico | 3 3021 | unico | 5 3022 |…
-
0
votes0
answers82
viewsJoin in 3 tables
I need my query to return who is the direct partner of the company "Father" and the company "daughter". I already got him to return the daughter company and the direct partner, but I need him to…
-
0
votes2
answers57
viewshow to consult by month?
In the BD table I have a column "day" type "date" keeping "yyyy-mm-dd", I’m trying to make a query that returns me the current month, I’ve tried many ways and nothing. <?php session_start();…
-
0
votes2
answers82
viewsDatabase returning no value
I have the following code: $sql="SELECT * FROM imoveis WHERE (suite LIKE '%".$suites."%' OR banheiro LIKE '%".$banheiro."%' OR quarto LIKE '%".$quarto."%' OR garagem LIKE '%".$garagens."%') AND…
-
0
votes2
answers267
views -
0
votes1
answer202
viewsHow do I not select repeated data that contains a specific value in SQL in a column?
Good evening guys, I’m beginner with Database, I have a Query that runs a filter following a rule: Rule: GSM which is repeated, and has in both STATUS = 'TEMPORARY ANOMALY' and its MOTIVO_ENVIO is…
-
0
votes1
answer38
viewsProblem with Select and PHP
I’m making a form where the person selects the Item 1, when selecting it another select appears with the categories of this item 1. The problem is when it has more than 1 item, as it is taking the…
-
0
votes1
answer33
viewsSelect help in two columns
I have the following select command: SELECT pa_coduni, pa_proc_id, sum(case when substr(pa_cmp, 1, 4) = 2017 then pa_qtdapr else 0 end) a2017, sum(case when substr(pa_cmp, 1, 4) = 2018 then…
-
0
votes1
answer649
viewsSQL De-to joining different data
I have an appointment taking away my patience, I have to join two tables of different years, but the reference codes changed from one year to another. How do I keep information on the same line.…
-
0
votes1
answer89
viewsMysql/PHP - Compare two lists and filter information
This is a matter of ENEM (jokes aside, let’s doubt). The answer may be in Mysql or in PHP. I need to do a search where I list all permissions that the user does not have. For this I have the…
-
0
votes0
answers105
viewsWhy doesn’t my select return in PHP?
I have a PHP query which is as follows: <?php $serverName = "servidor"; $connectionInfo = array( "Database"=>"banco", "UID"=>"user", "PWD"=>"senha"); $conn = sqlsrv_connect( $serverName,…
-
0
votes1
answer489
viewsInsert values into an INPUT type="number" or SELECT from the database
Can I import database values into an input or select field using html, php, Mysql and/or bootstrap only? (Obs.: do not master Javascript or Json) Follow image to illustrate, then I explain what I…
-
0
votes1
answer174
viewsDisplay the service name in select and the value in the input (Codeigniter)
I am enthusiastic, I do some simple things for a hobby, and in this case I’ve caught up with a part that I imagine for you must be very simple! I have a task system, in the form I have a service…
-
0
votes1
answer157
viewsMysql, SELECT according to the specialisation of the generic entity occurrence
In my database I have a generic entity "user", such entity is specialized in two other "store" and "service_provider", this specialization has total and exclusive characteristic, so that, an…
-
0
votes1
answer48
viewsDifficulty running a Select in Postgresql
I am having a difficulty in making a select in postgresql, in the select in question, I would like to display the name of distinct cities related to two distinct tables, below follows the DER and…
-
0
votes0
answers1760
viewsPostgres using variables in SELECT
In Mysql we can do: SET @pedido = 123; Afterward: SELECT @pedido We have something like that in postgres? I have looked on the web, but only found in the construction of functions and procedures The…
-
0
votes1
answer331
viewsSelect mysql with COUNT and GROUP BY MONTH
Hello, I am trying to put together the information of two tables to generate a graph, I need to count the total of record consults1 and consults2 and group by month: Currently I have this return:…
-
0
votes1
answer146
viewsPassing values from a Select Multiple to the bank (Codeigniter)
My view is like this: <div class="form-group"> <label for="categorias[]">Selecione a(s) categoria(s) referente(s) a foto:</label> <select name="categorias[]"…
-
0
votes2
answers750
viewsHow to pick up *ngFor Angular 7 item
Personal I have a select where I select a company <div class="form-group col-md-12"> <select class="form-control" name="Empresa" formControlName="Empresa"> <option selected…
-
0
votes0
answers271
viewsUsing Count(*) as a table filter
Good morning, I’m breaking my head with the following code: select ac.cd_agenda as "Código Agenda", m.nm_pessoa_fisica as "Médico", esp.ds_especialidade as "Especialidade", a.ds_complemento as…
-
0
votes0
answers224
viewsPopular selects with php, jquery and mysql
Good afternoon, colleagues I am with a doubt that for a long time I have been trying to solve and I can not get that is popular 4 selects using php, mysql, ajax and jquery. Searching for answers on…