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
-
1
votes1
answer283
viewsReturn Select Multiple values
all right with you all, I hope so. I have a question and I’m not getting through with my code. So let’s go I have a register screen with a select Multiple with the data below: <select…
-
1
votes1
answer90
views -
1
votes1
answer94
viewsReferencing OPTION in javascript
Next: I have to enter the name and price and status data, depending on the state it calculates the icms. I wanted to make sure that depending on the OPTION I select it calculated automatically, with…
-
1
votes2
answers190
viewsUsing a select value with Javascript
I need to use the value of a select in an if, at the moment I have this: Esse seria o HTML: <p>Quantidade de vidas? </p> <select> <option value="vidas1" id="vidas">Mais…
-
1
votes0
answers46
viewsProblem with Where
I’m using Mariadb and I have a clause problem WHERE bank. The query is inside Excel that brings me database periods through the month filter. But I was asked to change it to a time period, only it’s…
-
1
votes2
answers1272
viewsStore all records of a table in a variable (PHP)
I need to make a query in my Mysql database and store all rows that are returned within the variable $dadosBrutos. The intention is that each line be separated by the character "§", for example:…
-
1
votes1
answer59
viewsCOUNT in multiple mysql tables
Good afternoon, someone can inform me that there is wrong in the code below ? Because he just does the Count check on one table the other he ignores. Insert is correct but "Select Count" does not…
-
1
votes2
answers294
viewsTake field letters in MYSQL
I have a field with information in this pattern: "PLC__Line" 34355655413.3912. What can I use to take out the letters, _ and " in a select, leaving only the numbers and the dot? In Postgresql I know…
-
1
votes1
answer208
viewsUNION - SQL Server
I’m trying to make an appointment with Union, and it returns the following error message: Message 5335, Level 16, Status 1, Line 1 The type of text data cannot be used as an operand for UNION,…
-
1
votes2
answers1011
viewsMsg 8114 error in SQL Server while performing query
I’m having a problem executing a query in the SQL Server, where I try to bring a column with a conversion of done in a column like DATE and another column with an HTML code mounted. Follow the query…
-
1
votes2
answers343
viewsHow do I get the latest date by following a SQL filter?
I need to create a filter by following the following rule: GSM which is repeated, and which MOTIVO_ENVIO equal, and STATUS = 'ANOMALIA TEMPORÁRIA' import only the line that contains DATA_ALTERACAO…
-
1
votes1
answer46
viewsHow to query a column in the database and view filtered in 3 html columns?
good morning. I have a question that I have never come across before with php and mysql. I have the following example table in mysql: ITEM : DEP : QTD ============================= 1 : T01 : 1000 2…
-
1
votes3
answers340
viewsSort in SQL by prioritizing a specific field value
I have a large client table, and I need to select the following fields (sample data) id | id_ls | id_sistema_ls | nome | ativo ---------------------------------------- 1 | 1007 | 158849 | A | 0 2 |…
-
1
votes3
answers865
viewsSelect with due dates
How to resolve this issue. ID status valor vencimento clienteID 1220 Pendente 37,00 2019-02-20 2888 3146 Pendente 37,00 2019-03-20 2888 3147 Pendente 37,00 2019-04-07 2888 3148 Pendente 37,00…
-
1
votes2
answers313
viewsCalculate the average of a field in a specific year within a period
I was studying queries in mysql using the Employees demo database (link), when I decided to do a search in the table salaries than would be a report of how much the company spent per year on wages.…
-
1
votes2
answers82
viewsSelect inside the Where leaving the query too slow?
I have the following structure: And my query is that way SELECT tbl_nfes.*, count(tbl_nfe_itens.pedido > 0) as v, tbl_nfe_itens.status FROM tbl_nfes INNER JOIN tbl_nfe_itens ON tbl_nfes.nfe =…
-
1
votes1
answer18
viewsUnknow table in field list when performing select + sum
I’m trying to sum up the values of several different tables, tried two ways: Without citing the name of the database: SELECT SUM(animais_adocao.animal_pendente + animais_encontrados.animal_pendente…
-
1
votes2
answers133
viewsMysql - Sort a table and keep records together
I have this table below inside Mysql to which I need to order it from the following form: The table must be ordered in order of CPF. But I need the license plates that match, and I need them to…
-
1
votes1
answer590
viewsDOUBT SELECT WITH INNER JOIN AND COUNT
Hello, I am relatively new when the subject and database and need to generate a report with the following information,: Client name Qty of purchases made by each customer Total in R$ of each…
-
1
votes1
answer599
viewsAs popular several select
I managed to make the second select (player) automatically load according to the first selected (tournament). I need to make the third (game) load according to the second. In my case, I have a team,…
-
1
votes0
answers61
viewsQuery SQL in my Controller does not run on Server Error 1142
I created a website with Laravel 5.7, and uploaded to the server with the databases, all ok. All functions of my controller perform perfectly, except the Function down below: public function…
-
1
votes0
answers41
viewsAuto-fill with select Woocommerce checkout
I have the following code to generate a select and bring values within options: add_action( 'woocommerce_after_order_notes', 'cliente_woocommerce' ); function cliente_woocommerce( $checkout ) {…
-
1
votes2
answers939
viewsHow to compare Select
I have a query in Oracle a select with some sub selects, I have to consult several tables and bring all the data in the main select a single Row, I have two sub selects of the same table and I can…
-
1
votes0
answers92
viewsTrigger to ban scale insertion that is already working on that SQL Server date
Thank you for your time! 1° I’ll put the data and then I’ll point out my doubt, I’ve tried a thousand times and I can’t get the logic that works. I have the following table Scale Table CREATE TABLE…
-
1
votes1
answer443
viewsHow to separate the results of a SELECT in MYSQL into 2 foreach in PHP?
I have a recipes website where I bring the list of recipes according to the query below: SELECT * FROM receitas WHERE titulo LIKE '%batata%' ORDER BY ordem I wanted to show the first 3 featured…
-
1
votes1
answer154
viewsHyphen as column name in database
It is possible to work with hyphenated columns (-) within a select? Example: SELECT fm-codigo, descricao FROM ems2cad.pub.familia Progress database I am performing the query using PHP via ODBC,…
-
1
votes1
answer63
viewsPrint column created in Select in PHP
I have a table of projects and within this projects I have several students. I made a select in both tables to count how many students there are in each project, so I selected so : Select…
-
1
votes1
answer39
viewsWhy Between doesn’t bring the right answer
I have a specific table with the data that I do the search (sales_flat_order) where column status has among other values ('entregue', 'entregue_pd', 'entregue_pd_pago', 'avaliacao_solicitado',…
-
1
votes1
answer33
viewsCreate dynamic Divs (Codeigniter)
I need to create multiple Ivs inside a foreach in my view, so far so view: <?php echo form_open('admin/marcacao/registraMarcacoes'); ?> <div class="area-imagem"> <img src="<?=…
-
1
votes1
answer38
viewsMysql - merge queries into different tables
Hello I have the following commands: SELECT CASE Extract(month FROM data_cadastro) WHEN 1 THEN 'Janeiro' WHEN 2 THEN 'Fevereiro' WHEN 3 THEN 'Março' WHEN 4 THEN 'Abril' WHEN 5 THEN 'Maio' WHEN 6…
-
1
votes1
answer48
viewsUsing the value of a select with Javascript
I would like to know how to use the index of a select, for example I have select below function verificartime() { let time = window.document.getElementsByName("time") let restime =…
-
1
votes2
answers120
viewsMysql - Select - how to group two different values into a single value
I would like help on a subject. I have a query that lists requests(orders), and each request has its status, for example: 'confirmed', 'refused' and 'unmarked', I would like to create a Select that…
-
1
votes1
answer112
viewsSELECT in two different tables with variables of the same name
I have the following consultation to be made: "SELECT DISTINCT andamento_processual.licenciamento_cod, andamento_processual.inter_simplificada_cod, andamento_processual.inter_pretendida_cod,…
-
1
votes1
answer39
viewsCatch the lowest and highest value of a category with the count and ID
I need some help to make a SELECT that returns me the highest and lowest value of a category with its respective IDs and the amount of each category. The algorithm is complex, because it needs to…
-
1
votes1
answer31
viewsDoubt about SQL
Good afternoon guys, I am learning SQL and I have to do an exercise that is: Select the first and last names of employees and consultants working in the "Financial" department. Turns out I’m trying…
-
1
votes1
answer102
viewsFill Select based on the value of another previous Select
Hello, I would like to enter information that is in a database based on the value that the select is selected. Based on the value that the 'professional' input had appeared the services that are…
-
1
votes1
answer51
viewsAdd up the total quantity of a product with different batch? SQL ORACLE
Hello! How are you? I hope everyone is well! Guys I’m new in the business and I believe my problem is easy to solve, but I still have no knowledge to solve and from now I thank everyone for the…
-
1
votes1
answer59
viewsWhen I run my SQL function it returns NULL, even with data entered in the database
I created an SQL function to calculate the user’s daily calories by multiplying their baseline metabolic rate by the level of physical activity. Workbench shows no error when implementing my…
-
1
votes1
answer29
viewsHow to make a select and a "Sub Select" faster (in PHP)
I am facing problems with query for counting records. I have a table of clients (separated by owners and family members). And I need to count the records by status, but the status of the family will…
-
1
votes2
answers47
viewssql search filter - exception
Hello! I’m having a hard time developing a logic for a bank search. I need to return from the bank a table with the student list enrolled with a certain type of voucher. But each student can have N…
-
1
votes2
answers68
viewsSum of a product returning in a column the total
Sum of a product returning in a column the total Guys good night, I wonder how I can make a SELECT that returns exactly the same as what is below (I modified in F12 to see if you can understand…
-
1
votes0
answers25
viewsProblem with Trigger in select/Insert
Personal I created two entities, where the information of one is manipulated by the other. That is, I own an entity conta and another conta_extrato the balance of the entity account is modified only…
-
1
votes1
answer57
viewsPostgresql: How to select a field based on the maximum value of another field?
I have a table with the following configuration: create table baixas_do_requerimento as codigo_requerimento text, tipo_baixa text, data_baixa timestamp Each código_requerimento can repeat numerous…
-
1
votes1
answer44
viewsHow to select data that depends on other tables that have another key in common?
Hello! I was working on a database project using the SQL language in Mysql Workbench. The setting of my project is a university library where we have the tables: (Bold = PK | Italic = FK)…
-
1
votes1
answer28
viewsInsert a select in c#
Good night! Personal, I have a select working normally and displaying the result in a datagridviewer all straight though, I need to take the result of this query that is done in the mysql database…
-
0
votes1
answer5030
viewsJava check, show values recorded in Mysql database
I need help I’m making a game in java and I need all records and files and player etc in my table but I can not connect with the database and much less check and display values Ps: sun.java tutorial…
-
0
votes1
answer1119
viewsHow to style, with CSS, a SELECT that is inside PHP?
<?php include "conexao.php"; $sql = "select * from categorias"; $dados = pg_query($sql); $resposta = ""; while($linha = pg_fetch_array($dados)){ $nome_categoria = $linha["nome_categoria"];…
-
0
votes1
answer35
viewsMysql Query - Transfer
I have the following appointment: SELECT despesa.codRequisicao, despesa.histDespesa, despesa.despesaPassagem, despesa.despesaTaxi, despesa.despesaHotel, despesa.despesaRefeicao,…
-
0
votes1
answer37
viewsHow to get all lines using duplicate value in IN
How do I get all lines using IN(), and inside IN() have duplicate values SELECT NOME FROM PESSOA WHERE ID IN (1,1,1,2,3,3,4) I want in return come 3 times the name of ID 1, and 2 times the name of…
-
0
votes1
answer84
viewsSelect saves same data in 2 different fields
I need that when the employee selects the product the input "product code" be filled automatically, so far so good but when write the data in the BD, the fields product and product code keep the…