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
votes2
answers52
viewsSelect from empty data
My code returns all users, checking if they paid the last month, however I connect two tables, one of all customers with the registered payments table, I want to print on jTable even if you have no…
-
0
votes2
answers112
viewsMark checkboxes when choosing select value, coming from a PHP (Laravel) BD
I have a problem I don’t know how to fix and I don’t know how to look. I’m building a system in the php - laravel. This system will have user levels. I’ve done all the registration, changes, user…
-
0
votes2
answers170
viewsAre there limits to the use of logical operators in the Mysql query?
Well, I wonder if there are limits on how many logical operators I can use in a Mysql query, for example: $sql = "SELECT * FROM usuarios WHERE nome = 'Fulano' OR email = '[email protected]' AND id…
-
0
votes2
answers204
views -
0
votes0
answers127
viewsSelect in two fields of a table
Hello, I’m going through a problem and I would like to ask for your help. Here’s the thing: I am integrating a PHP system to the Wordpress Woocommerce plugin and I need to order some products from…
-
0
votes1
answer35
viewsQuery revision
I have this query in order to list users with more comments, however, it cannot display users with the banned column=true. SELECT * FROM usuarios a INNER JOIN topicos_comentarios b ON a.usuario =…
-
0
votes1
answer28
viewsMysql ambiguous error
I’m having an error in my Select SELECT *, SUM(IF(debito_credito_financeiro = 'D', valor_financeiro, 0)) AS debito, SUM(IF(debito_credito_financeiro = 'C', valor_financeiro, 0)) AS credito, (SELECT…
-
0
votes0
answers58
viewsHow to register, query and display data in the same request?
I have a form where the user enters his data (name, experience, height and weight), the information is registered in the database, compared and is returned to the user the ideal board model…
-
0
votes1
answer79
viewsHow to make a select`Multiple` start with the first option already marked PHP Mysql
Follows my component: $query_menu = mysql_query("SELECT rm_id AS FUNCAO, rm_desc AS DESCRICAO, rm_obs AS OBSERVACAO, rm_status AS STATUS FROM radios_menu WHERE rm_status='0'"); echo"<div…
-
0
votes1
answer11
viewsMS ACCESS Subselect "At Most one record can be returned by this subquery."
Would someone know to tell me the pq of this subselect is causing the error: "At Most one record can be returned by this subquery."? (SELECT TOP 1 J.observacao " + " FROM tblPendenciaHistorico J " +…
-
0
votes2
answers621
viewsGroup [group by] SQL Firebird
I wonder if there is a way I can make a query where I can bring fields that are not in my group by. I have the following code: select sum(TAB_FATURAMENTO.vl_item),CLIENTE.insc_cnpj from…
-
0
votes0
answers66
viewsMake SELECT display a certain value of a column last, keeping sorting by another column
I am doing the following select in a database and displaying the result in a php table: SELECT ID_PRDC, PRDC_ID_PRDT, PRDC_ID_SEM, DATA_PRDC, LINHA.NM_LN, PRODUTO.NM_PRDT, SEMI_ACABADO, NUM_OP,…
-
0
votes1
answer1471
viewsMerge different columns in the same result
I am trying to generate a SELECT in Postgresql that joins columns of different tables in the same column of the result. Example: Usuario ----------------------- | id | nome | regra |…
-
0
votes3
answers2649
viewsSQL to search the entire database
Is there a command to select all tables in a mysql database? Like I have several tables in my database with diverse content. I need a way that a user can search for a keyword in all tables.
-
0
votes1
answer264
viewsSelect command to delete duplicates by summing the results
How to change a table that looks like this: produto | quant a | 10 a | 5 b | 8 b | 3 And leave her like this: produto | quant a | 15 b | 11 Is there any command select that I can use to make this…
-
0
votes1
answer32
viewsHow to select between one hour and another in SQL
I need to solve a simple exercise asking to inform the amount of books sold between 13h and 17h30 of all dates. I was able to pull between 1:00 and 5:00 but not with the minutes "5:30". I did so:…
-
0
votes3
answers14234
viewsRemove options from select with jQuery
I’m trying to take out all the option's of a select I have, but I’ve used up all the code of the jQuery but they don’t come out. I’m making a filter where the person will select a city and after…
-
0
votes1
answer242
viewsHow to allow the user to add a new option in a <select>?
I need to mount a select where the user can add new options, so I need the select to allow typing and a button next to it would call the function to include in the list. How can I do that? I only…
-
0
votes1
answer1829
viewsVariable inside the WHERE of a select
I have a variable that changes your content according to some user actions! I intend to use this same variable within a select, as follows! " Select * FROM tabele WHERE '$variável' " But when I…
-
0
votes1
answer168
viewsQuery 2 tables in a sql database and display repeated values
I have 2 tables in my database, a call pessoas and another call resultado, I am filling the table result with the draws made by mega sena, the table result has the fields: data, dez1, dez2, dez3,…
-
0
votes1
answer59
viewsList data from 2 tables linked to the parent table
ORDER TABLE --------------------------- | id_pedido | pedido_data | --------------------------- | 1 | 2016-01-01 | --------------------------- TABLE PEDIDO_ITENS…
-
0
votes0
answers105
viewsColumn Count error doesn’t match value Count at Row 1, for a select
My system, in the save button, I inserted 3 tables at the same time, being that 2 uses FK, I am using the field cad_id as FK in 2 tables, I am making a select to take in the bank a single field…
-
0
votes0
answers140
viewsHow to perform a SELECT DISTINCT - H2
I need to perform a SELECT DISTINCTin the database H2 but the way I’m doing it’s not returning anything to me: SELECT DISTINCT lote FROM LotesEncerrados l ORDER BY l.lote ASC I did the same in the…
-
0
votes0
answers151
viewsSeparate Mysql output in blocks in PHP
I have a table of properties divided into several categories and I want to list them on my PHP page. The detail is that I wish that in one region of the page be listed the houses, in another the…
-
0
votes1
answer31
viewsUnexpected Result in SELECT
I have a SELECT that does Join in three tables, taking order data, requested client, responsible assistant and values related to orders. all the Clientes and Assistentes duplicates in that query are…
-
0
votes2
answers101
viewsHow to mark options in ajax return?
I have an array of ids and I’m returning this array in the ajax response. How to compare this array with the select options and mark the option if it matches the array index? In PHP, we use the…
-
0
votes1
answer113
viewsOpen javascript with Select Option
I’m wanting to open Check() and open it when the select option is pressed. <select> <option href='javascript:;' onchange="abrirVit();" value="canto">Vitória - Praia do…
-
0
votes1
answer47
viewsProcedure does not return the full column
I created a project with the ibexpert, does the commit correctly, but at the time of turning the Procedure, get the bug: Multiple Rows in Singleton select. My intention is to list all values in the…
-
0
votes1
answer91
viewsDoubt with select case
I have the following query: select f.no_equipe, i.no_cbo, count(b.tp_atend) from tb_equipe F, tb_cds_prof G, tb_cbo I, tb_cds_ficha_atend_individual D, tb_cds_atend_individual B where F.nu_ine =…
-
0
votes1
answer76
viewsHow to run a php command dynamically while running the program
I’m making an application web that displays a video stream, but every time I use it, you need to reload the page, and I need it to happen automatically. My idea is to dynamically execute a query in…
-
0
votes2
answers2732
viewsEvents tagged with <select><option>
I’m trying to make a page with html+javascript, but I don’t know anything about php... Anyway, my question is this! I have created an options box, and when the user selects a certain option, I want…
-
0
votes2
answers168
viewsGrouping invoices in php mysql delay
Hello, I’m beginner, I’m learning to select, and would like to receive help from this wonderful community. I need to take only the invoices that are with the a_winning status of each student, would…
-
0
votes4
answers152
viewsUsing Mysql how to create a Select that searches "together" words
In Mysql how to create a select that searches "together" words. For example: SELECT pessoa FROM tabela WHERE pessoa like '%josedasilva%' But in this way nothing returns. Because it is registered as…
-
0
votes1
answer94
viewsTable with select and Submit
Hello friends I’m trying to make a table, being for each table item appears a <select> and a submit that will send data via POST, as it is relative how many units will appear it is not…
-
0
votes3
answers860
viewsmake a select by grouping by year
I have a client field on it I need to make a Count of how many customers were registered during the years 2016, 2017 and 2018 i was making 3 select, being that in each one I was making a Where…
-
0
votes1
answer52
viewsSave total lines of a SELECT with WHERE in a variable
I need to develop a code where the line total of a SELECT is stored in a variable. I wrote the code below, but when I use WHERE returns an error "Notice: Trying to get Property of non-object in". It…
-
0
votes2
answers54
viewsSelect only if the ID is in 2 tables
I have 2 tables in Mysql, INSCRICAO1 and INSCRICAO2. Both have a field called COD that receives a user code. To INSCRICAO1 stores your personal information To INSCRICAO2 saves user’s car information…
-
0
votes2
answers109
viewsHow to bring SQL result grouped by year and within months
I have a table like this: data |id 2017-02-01 00:00:00|1 2017-02-01 00:00:00|5 2017-04-01 00:00:00|2 2018-02-01 00:00:00|3 2018-04-01 00:00:00|4 Then I make a query with PHP in Mysql that brings me…
-
0
votes1
answer57
viewsHow to pass the value of a "$variable" coming from another page, and use it in a select PDO
Next, first I would like to know if it is possible to receive from another page, through a session_start(), value of a variable and apply it in a select. I’m doing it this way: At the beginning of…
-
0
votes1
answer28
viewsDoubt with this query
My teacher made the following query, to show the total amount of stock of each product, however I do not understand very well how it does to generate the total stock quantity of each product,…
-
0
votes0
answers93
viewsCursor.getColumnIndex() returns -1
I’m trying to accomplish a select in the database of Android, but every time I try, it ends up generating error. By debug discover that one of the columns, when performing the getColumnIndex() is…
-
0
votes1
answer47
viewsSelect 5 thousand rows from a table
I have a table with more than 5 thousand lines, where I have a column with year, nomes_municipios and another with values. I can get an average with a municipality that is represented on a line, but…
selectasked 6 years, 7 months ago Jonatã Paulino 135 -
0
votes1
answer208
viewsSelect with pyodbc
I am trying to use the string I get from an Entry and Optionmenu to perform the Sqlserver search but from the following error: TypeError: not enough arguments for format string Here is the code of…
-
0
votes2
answers1867
viewsView with double SELECT from the same table
I need to build a VIEW with three fields, but one depends on the other to be calculated (two of them are from the same table on different lines need "link them"), how do I aggregate these fields in…
-
0
votes2
answers56
viewsHow to select in a table as if it were two records
On the table person has the following information ID | NOME | É_ALUNO | É_RESPONSAVEL 1 | ALUNO | TRUE | FALSE 2 | RESPON| FALSE | TRUE There is another table with the name student, in this table…
-
0
votes1
answer205
viewsMerge results from two tables
I need to make a SELECT in two tables and unite the results. My tables are "cursos_aula" and "cursos_progresso". In the table "cursos_aula" I have all the classes of a course. In the table "progress…
-
0
votes1
answer150
viewsHow to sort the result of a query by a column where there is a value in another column in the same table?
I have a table with several columns, and I want to sort the results by the values of one column where another column in the same table is equal to a value. I have tried implementing the query with…
-
0
votes0
answers259
viewsSQL query in 2 database on different (mysql) servers
Hello. First of all, I make it clear that I don’t know if this is possible. I am trying to make an SQL query where I need the union data (INNER JOIN) of 02 tables that are on different servers (One…
-
0
votes1
answer56
viewsPHP | MYSQL Error: Operand should contain 10 column(s)
I am trying to develop a Query where, need to be Consulted in 6 equal tables if there is any specific value. Here is my Query: SELECT ( CASE WHEN (SELECT * FROM sala1 WHERE aluno =…
-
0
votes0
answers28
viewsSelect problem using php and mysql
I’m new with the development in php and was seeing some examples of select in a table in mysql on the net, but no successful execution. The code is as follows:: $conexao = mysql_connect(DB_HOST,…