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
-
4
votes2
answers25412
viewsUsing WHERE with INNER JOIN
There is a way to use one WHEREto make a SELECTwith INNER JOIN ? my case is this: SELECT CodCli, NomeCli FROM tbvendas INNER JOIN tbclientes ON tbvendas.CodCli = tbclientes.AutoCod I’d like to put a…
-
4
votes1
answer5408
viewsProblem when using Select
I’m trying to use the form select of this site here: http://materializecss.com/forms.html But when I put on my site the only thing that appears is this: "Materialize Multiple Select" Someone knows…
-
4
votes3
answers162
viewsProblems with SELECT with 2 Wheres
I’m having a bit of an amateur problem here. I’m not getting this SELECT from 2 CONDITIONS, and I can’t find the ERROR! Someone please give me a light there! Follows the Code: OleDbConnection Con =…
-
4
votes2
answers167
viewsTake mysql field dynamically
I created a select command based on information sent by the user, e.g.: $anoini = $_GET['anoini']; //variavel com ano escolhido pelo usuário $anofim = 2016; //ano final é 2016 $s = 'SELECT…
-
4
votes3
answers1000
viewsSelect with the last record
I need to value the inventory of the company I work for and for that I will take the last value of the items. I was using the MAX, but I realized that if I did this, it would return me the highest…
-
4
votes1
answer111
viewsBring only one product per affiliate to sql server
Good day I need to bring only one product per affiliate, but in my table I have several times the same product just changing the date, I would like to take the product of the last date. What do I…
-
4
votes2
answers558
viewsSort by the number of repetitions in a column?
In a query in Mysql I need to select the results and sort the results based on the amount they repeat using the column id_livro, for example: My table comments: +----------------+-------------+ |…
-
4
votes2
answers2185
viewsHow popular select from another select using python and Django?
Good evening, everyone! I’m new to the forum and started doing a little project with python and Django, where I am trying to fill a select according to the option selected in another. However, as a…
-
4
votes3
answers160
viewsSelect Where IN all records
Gentlemen , will searched for days the answers to this doubt that I think is silly , but I could not. I created a view that has Matricula | Name |Job |Shift | Centrocusto | Codtreina | Status I made…
-
4
votes2
answers2954
viewsSearch XML field information in SQL
I need to perform a search inside a field where it stores an XML The XML is from a CT-e and in it has a series of tags and I need to find a data within a specific tag. Below the structure of the…
-
4
votes1
answer114
viewsDOUBT About the use of SELECT and Standard Tables
I have a question as to the advantages of having standardised tables and their forms of use within a SELECT. Suppose the following tables: -------------- | tb_endereco | -------------- | id | | rua…
-
4
votes1
answer281
viewsSELECT Mysql - Prioritizing results that are not null
Hello, I have a table with several records, which are not mandatory. I need to execute a query, and bring only the result that has more information that is not null. Ex: ID | Col-A | Col-B | Col-C |…
-
4
votes3
answers902
viewsRETURN THE SUM OF MAXIMUM 3 SQL VALUES
I have a table and I need to return the following: check based on recipient column, add the 3 largest amount of that recipient, bring in query only if the sum of the 3 largest ones are >= 1024:…
-
4
votes1
answer784
viewsSelect the first row of each group in Mysql
Suppose I have such a table: item | group -------+-------- item a | group x item b | group y item c | group y item d | group x item e | group z And that I want to select a single item to represent…
-
4
votes2
answers106
viewsHelp with select and repeat records
I have a postgresql database with a table like this: id_usuario | dt_atualizacao | atualizacao | outros_dados 123 | 01-01-2001 | 0 | abc 123 | 01-01-2005 | 1 | abe 123 | 01-01-2012 | 1 | acd 123 |…
-
4
votes2
answers299
viewsSelect Laravel Entering Next Record Alone
Good evening, I have a project in Laravel and I’m having the following difficulty: I have a controller that retrieves data from my database, has a variable that receives string and this string…
-
4
votes2
answers238
viewsHow to search MYSQL search for word in title and then in text and sort by title first
I have a table with title and content and wanted to do a search to see if the term is in any of these fields. If you have, bring the results of the title first and then the content tabela…
-
3
votes1
answer205
viewsSqlite - count primary keys that were not referenced as foreign key
First, I am trying to count the primary keys of a table that WERE and WERE NOT referenced as a foreign key in another table. Also, I want to filter the search using the clause LIKE to show only…
-
3
votes2
answers1273
viewsHow to bring in the SELECT result the conditions entered as parameters?
Is there any way to bring in the result of SELECT the parameter values used in the clause WHERE ? Example: SELECT a.*, cast(:dataIni as date) AS inidate , cast(:dataFin as date) AS inidate FROM…
-
3
votes2
answers1138
views -
3
votes2
answers101
viewsQuery of N records by Item
I have a history table on DB2 and would like to carry out a PLACA however despite this I would have to return the last 5 records of each PLACA. Ex.: |ID |PLACA | DATA | VALOR | |12 |ABC | 2014-08-28…
-
3
votes3
answers19969
viewsTake the value of select
My Select is like this: <select class="input-medium ajuste" id="sel_mes"> <option value="09/03/2014">Março - 2014</option> <option value="09/04/2014">Abril -…
-
3
votes2
answers1434
viewsObtaining the number of dependents of an official
I’m trying to do a search between 3 tables: Employee,Dependents,Function_has_dependents; I want to do the research that shows the number of dependents of each employee. I did the following: select…
-
3
votes1
answer968
viewsHow to verify the occurrence of a string in a row and pick up x characters on the left and y on the right?
I’m having a problem with a Mysql query and I’m looking for help. Suppose I have many lines in the PROCESSES column and one of them is like this: IBAMAPROCUR: DF00025372 ADRIANA MAIA VENTURINIAPDO:…
-
3
votes1
answer83
viewsI can’t perform a Select
I’m having a question about how I should ride the SELECT for a particular function. The scenario is as follows: I have 4 tables: Tab_Pessoa - Tab_Cliente - Tab_Autorizado - Tab_Cliente_Autorizado.…
-
3
votes2
answers578
viewsGet the optgroup label and option value and display in a div with Jquery
I have the following code: <select> <optgroup label="fruta"> <option value="banana">banana</option> <option value="uva">uva</option> </optgroup>…
-
3
votes2
answers600
viewsEnable select HTML with
I have a table, where fields start disabled, and in a checkbox I choose which field to enable. Tagged input, works perfectly. But when I try to use with the select the same script does not work. I…
-
3
votes1
answer265
views -
3
votes2
answers2034
viewsPassing values from a select to subselect
I have the following query: SELECT rp.colaborador as codigo_, t.nome, count(rp.*) as presencas, ((100 * (select count(rp.*) from empresa.cad_reuniao_presencas rp join empresa.cad_terceiros t on…
-
3
votes1
answer946
viewsReset value of a select field with jQuery/Boostrap
Hello, how can I reset a select field? <label for="IDSelect">Campo</label> <select data-live-search="true" title="--" name="NAMESelect" id="IDSelect"> <option value="1">Valor…
-
3
votes1
answer134
viewsError when selecting multiple data in php login
I have a script simple that makes a user of mine website can view your data on a page, for example: name, email, age, image. See script down below: <html> <head> <title> Login de…
-
3
votes3
answers176
viewsSELECT in two tables, with ID separated by comma
Hello! How to make a SELECT that returns data from the first table, whose "id" is separated by commas in the second table? Example: tbl_cores id | cor 1 | azul 2 | verde 3 | amarelo 4 | vermelho…
-
3
votes1
answer52
viewsselect in elements that are not in the array
I have a PHP array with Ids: $idNaoEnvia['1', '3', '6'] And a table called account in MYSQL: ID | NOME 1 | caio 2 | antonio 3 | cleber 4 | marcos 5 | leonardo 6 | andre Wanted using PDO to give a…
-
3
votes1
answer269
viewsPIVOT - SELECT reversing row and column
I have a table like this: codigo ano quant 100 2014 15 100 2015 13 100 2016 20 101 2015 15 102 2016 22 102 2014 05 I want to create a query that lists me the code like this: codigo 2014 2015 2016…
-
3
votes1
answer504
viewsMysql select Random with priorities
I have the following scenario, I have a table and I need to select an order by RAND(). But I would like to put some conditions for example: TABELA ID | NOME | IDADE | GRUPO Dice 1 | Hiago | 20 | 1 2…
-
3
votes3
answers2181
views -
3
votes2
answers282
viewsValidate the return of select PHP
I am making a select and before printing the form on the screen I would like to validate if the select returned lines, as I have tried this in various ways without success. $stmt =…
-
3
votes2
answers1401
viewsHow to mount a SELECT with ordered nonexistent numeric column
I want to make a SELECT with some existing columns in the database and add a ordered numerical column starting at 1 for each line (I don’t want the ID). I’m using Postgresql 8.4. Example: SELECT…
-
3
votes1
answer103
viewsDoubt in SQL ORACLE query
I am thinking of making a View for the development of reports, and I bumped into the following problem. I would like to join columns PUBLICO1, PUBLICO2, PUBLICO3, PUBLICO4 in a single column. Ex.:…
-
3
votes1
answer53
viewsDataset does not recognize LIKE and search parameters
Good night.I have a table in the Mysql database and am using a Dataset to handle it in my Windows Form project. The problem is that when I try to use a query with LIKE, it does not recognize the…
-
3
votes1
answer928
viewsWhen clicking on a select item, show input
I want when I click the select "OTHER" to appear next to an input, but so far unsuccessful. My code HTML and JS: function mostraCampo( el ) { var outros = document.getElementById('outros'); if…
-
3
votes1
answer883
viewsMultiple results in a single record - Oracle
I have the following situation: I have a select where I return that the patient TEST passed the clinic ABC, and performed procedure 01 and 02, however in the result of query he returns to me like…
-
3
votes1
answer347
viewsSelect column with Excel *** value
Good morning friends! I need some help. I am making a "Select" of an Excel spreadsheet in VB.Net to import the data in the database but a column is not bringing the data correctly. This column has…
-
3
votes2
answers381
viewsSELECT issues with postgresql
I am making a migration from mysql to postgres, but there is an error happening, not much experience with postgres: SELECT SELECT m.* , (SELECT c.id FROM corridas c WHERE c.motoqueiro = m.id AND…
-
3
votes1
answer118
viewsRelease Input by clicking Select
Hello, I have a question in my code. I need that when clicking a Select is displayed fields for entries. For example: <form role="form" class="form-horizontal"> <div class="form-group">…
-
3
votes2
answers2800
viewsHow to get the records from the last 15 days - Postgresql
I have a table called Entrega where all deliveries made with their respective dates are stored, how can I bring only deliveries from the last 15 days? Doing so I can bring deliveries from the day 10…
-
3
votes1
answer115
viewsProblems with select in multiple tables
I’m trying to make the conversion of a select from sql server to Dapper, as it was very big, I’m wanting to leave more lean and readable... However this appearing error in some passages SELECT…
-
3
votes1
answer531
viewsSQL select with dynamic Where in ABAP
There is the possibility to create a select with dynamic Where in the abap language?
-
3
votes3
answers161
viewsHow to perform a select by multiple fk?
I have a question about one (or more) select. I have the following bank created and I need to do a search for a certain recipe based on one (or more, and here’s the problem) ingredients. How can I…
-
3
votes1
answer874
viewsAscending and descending order Angularjs
I have a set of data that I organize through a choice, increasing or decreasing, or I can leave in the order that is already. The system works normally with the order of the elements, the problem is…