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
answer532
viewsSeparate values from a multi select in columns
in my system, I have a multi select as they can come in the image below: And I export this variable in this select SELECT REPLACE(p.Argautor, ',', ';') AS Argautor FROM jud_Processos p LEFT JOIN…
-
1
votes1
answer162
viewsSQL doubt using subquery and IN command
I need to do the following. So-and-so has several car models. I want to list other users who also have 3 specific car models that so-and-so has. What I did: $iduser = id do fulano $mod1 = modelo de…
-
1
votes1
answer35
viewsSelect record that contains result equivalent to a variable
I have a column in my mysql table, in which it is called "positions", where several values in int are placed there, however, with the "|" of division. Example: 8|19|10|20| And each number represents…
-
1
votes3
answers127
viewsHow to check if a select is null
Guys, I have this code that pulls info from the server try { $conecta = new PDO("mysql:host=$servidor;dbname=$banco", $usuario, $senha); $consulta = $conecta->prepare('SELECT * FROM…
-
1
votes2
answers34
viewsSelect items that do not contain in a second table
I need to select data from a table only when the codigo this table does not appear in a second table. Briefly this would be it. I have the table entregaitem with the following columns…
-
1
votes2
answers35
viewsSelect multiple tables by sorting by date
mysql> SELECT * FROM COLABORADOR; +----+----------+ | ID | NOME | +----+----------+ | 2 | FULANO 2 | | 3 | FULANO 3 | +----+----------+ 2 rows in set (0.00 sec) mysql> SELECT * FROM JORNADA;…
-
1
votes1
answer30
viewsI want to recognize Cpf in the table, display a page with other data. Where am I missing?
Warning: mysql_num_rows() expects Parameter 1 to be Resource, Object Given in C: xampp htdocs associated.php on line 15 My php code <?php include"conectar.php"; // RECEBENDO OS DADOS PREENCHIDOS…
-
1
votes0
answers43
viewsdatatables does not display data with a query using JOIN. What to do?
<?php include('../conection/db.php'); include('function.php'); $query = ''; $output = array(); $query .= "SELECT i.Tipo as Tipo, c.Descricao as Descricao, c.Anexo as Anexo from tbl_instituicao as…
-
1
votes1
answer515
viewsSelect com when e case
I have the following select query: select F.nu_ine INE, to_char(D.dt_ficha, 'YYYYMM') as CMP, I.co_cbo_2002 CBO, CASE WHEN (B.tp_atend = 1 or B.tp_atend = 2 or B.tp_atend = 5) and I.co_cbo_2002 !=…
-
1
votes1
answer180
views -
1
votes1
answer1015
viewsSelect two tables with different columns in ORACLE
I have three tables, one call ALUNO, a callMATRICULA and another call CLASSE and I need to select all students who are male and who belong to the same class as a student who has a specific RGM. The…
-
1
votes1
answer539
viewsUsing the Select 2 plugin - How to disable select click
My page: <!DOCTYPE html> <html> <head> <title></title> <!-- 3 coisas para o plugin funcionar --> <link rel="stylesheet" type="text/css"…
-
1
votes1
answer121
viewsSelect within for
Next, my doubt is more about logic anyway.. I have a python script in which I use psycopg2 to perform database searches. But I need to do this within a for. I have full notion that doing a search…
-
1
votes1
answer1060
viewsDOUBT ABOUT SUBSELECT IN FIREBIRD
Hello, good evening! I have a table that involves the input and output part of a box, an example of this is: no day 01/01/2018 the user reported that entered R $ 200,00 in the company’s vault, the…
-
1
votes2
answers66
viewsQuery between tables
I need to make a query as follows: select a jovem that is in the same cidade and estado that the mentor and that has the largest number of equal features that of the mentor. My consultation: SELECT…
-
1
votes1
answer69
viewsAfter choosing an option in the selectbox, disable and change the text of two other selectboxes
Beauty guys. I have three selectbox and after choosing in the first Select box the option "Movies", I would like to disable the other two selectbox and modify its text to "N/A": <select…
-
1
votes1
answer158
viewsRedirect through the option value and keep the option selected
I need to redirect according to the "option" value and keep this "option" selected after redirect. I can redirect through this code: $(function() { // bind change event to select…
-
1
votes1
answer64
viewsTaking HTML data for a SELECT in another file without POST
Good morning guys, I am starting my life in PHP programming and I have a little problem here. I have the following form: <form action="cadastro_pex.php" method="post"> <label>Período:…
-
1
votes0
answers206
viewsOracle - Lock preventing SELECT
Lock preventing SELECT The situation is as follows : An ERP application (Totvs) with multiple tables All these tables use as primary key a standard field R_E_C_N_O_ The application (I believe)…
-
1
votes3
answers250
viewsHow to select only the largest drive in Sql?
I am in need of a help to search for the last move in the stock of each product. It happens that in the clause I made, he is returning me all sales related to that product, and I only need the…
-
1
votes1
answer37
viewsHow to group results from a query?
I have the following consultation with the name of the recipe and the ingredients: $query = (" SELECT r.receita, i.ingrediente FROM ptp_receitas r, ptp_receitas_ingredientes ri, ptp_ingredientes i…
-
1
votes2
answers128
viewsHow to separate records into blocks for parallel processing?
I have a table in SQL Server that makes the control of messages to be sent and a routine in C#, configured in a Cron, which selects pending messages, sends and marks as sent. What I’m implementing…
-
1
votes1
answer100
viewsQuery 2 SQL tables bring all the results
I’m doing an SQL query to bring users, but I consult 2 tables: users and users_vip No users have all users and users_vip only those who are vip (active or not). When I make my query joining the 2…
-
1
votes1
answer540
viewsHow to select XML and return a specific column from an anonymous block?
I have an anonymous block in PL/SQL that returns to me an XML as the result of running a web service. How do I select this XML to only get a desired column? Anonymous block: DECLARE l_filename…
-
1
votes1
answer421
viewsFull size auto select adjustment via option available
I normally research and do not disturb the patience of the members here, but this time I specifically need an example. See: <!DOCTYPE html> <html> <body> <select id="lista"…
-
1
votes0
answers134
viewsHow to validate select Multiple?
Context I need to validate the multiple checkbox. It is necessary to validate the second checkbox. Doubt Where and how do these validations? In php or Java? Logic of Validation Codes: Locality…
-
1
votes1
answer38
views -
1
votes2
answers267
viewsHow to get the value of a select item by clicking on it
In the font shown below, logic fails to capture the click on the element of select returning only the first option, and from the looks of it is an index problem - selectedIndex. Observe: function…
-
1
votes1
answer245
viewsMysql comparing a number with string returns true if the string starts with the number
I have the following table in the database: idUser - Username - Group 1 - John - 5GR 2 - Donate - 1GR And the following query: SELECT * FROM `table` WHERE `idUser` = '$name' OR `Group = '$name'…
-
1
votes3
answers393
viewsGet last ID or date inserted in a Mysql table
I have a history of conversations that are recorded in the table sql "conversation" and I want to pick up who was the last person who inserted a message in the conversation to know if it was the…
-
1
votes1
answer312
viewsSelect without repeating data
I am developing a website for a musical project and I am having difficulty with select, is the following, I have 2 tables an album that contains information from the cd (artwork, album title, name…
-
1
votes1
answer578
viewsORDER BY or LIMIT. What is processed first in SQL Select?
Friends, what is first processed in SQL Select? "Order by" or "Limit"? For example, if I have a table with cities of several states. Then I search the cities with more than 100 thousand inhabitants…
-
1
votes1
answer624
viewsSum values in a Select (postgres)
I have a small problem, I need to fill a gridView in C#, but my query is not adding up some values and this is causing the company code to be repeated and with the value "separate". The value I need…
-
1
votes2
answers668
viewsSELECT pulling data from Database
I’m not getting a select to pull the data from the database, I wish someone could help me... <!DOCTYPE html> <html> <head> <title>TODO supply a title</title> <meta…
-
1
votes1
answer59
viewsHow to perform this Select?
I need to relate data according to the last item found in the user table, for example: Table: +----------------+-------------+ | user_id | title_id | +----------------+-------------+ | 154138746 |…
-
1
votes2
answers1049
viewsHow to query MYSQL and PHP using an array as a WHERE pro condition
I’m making a query in MYSQL that brings the emails that were sent. These emails are in the email column, separated by comma, as in the email table below. emailsenviados IDenvio|emails 1…
-
1
votes1
answer81
viewsMysql - Inner Join runs on PHPADMIN but not on php SCRIPT
I have a small PHP script to interact with MAKERIOD. When I run select in PHPADMIN I get the return : "Showing 0 - 16 records (total 17, query took 8.0945 seconds.)" SELECT Tbdiario.cn1,…
-
1
votes1
answer173
viewsPHP MYSQL Query Bring Results from Today and This Week
I’m assembling type a CRM, where makes queries in MYSQL with PHP to bring the appointments I have today, this week and all others. I wish you’d bring something like that: Hoje: compromisso A…
-
1
votes2
answers88
viewsQuery in SQL SERVER 2017
I need to perform a query in SQL Server 2017, where I need to bring the following information: Codigo do chamado, Data Abertura, Interação, Analista, UltimaInteração(would be the date of the last…
-
1
votes1
answer1842
viewsInsert quote text in mysql database
I am using the following code to insert a quoted text into a mysql database: mysqli_query($con, "insert into medicacaohistorico (data, unidadeori, unidadedes, itemdetalhe, qtd, solicitante,…
-
1
votes1
answer71
viewsTable header with Mysql query
doesn’t bring what I want, someone can tell me what I’m missing by looking at the code? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />…
-
1
votes1
answer90
viewsUsing Case or if
I’m a beginner in SQL and I’m having difficulty using the CASE WHEN. I have a table called CRM_PROCESSO, in which you have a column with the option of Status, but the answer to this status is…
-
1
votes3
answers1210
viewsSelect to bring the amount of certain records in related tables
Speak guys, is the following, in the MYSQL database I have these 3 tables: CONTROLS: Here I do the training entries performed. Note that it is possible to insert several employees in the same line…
-
1
votes1
answer754
viewsDividing sql results in lines through delimiter
Good afternoon, you guys. I have a hard time making a select on a DB postgres here. For some reason, the programmer invented to create a field where if the user input two notes at the same time, the…
-
1
votes1
answer133
viewsClause Where takes too long
I’m wearing the Laravel 5.6 My model is normal <?php namespace App; use Illuminate\Database\Eloquent\Model; class MyTable extends Model { protected $table = 'myTable'; public $timestamps = false;…
-
1
votes2
answers289
viewsAdd a column with data in Varchar2 format
I want to sum up the column Value that is of the type Varchar2, I know that to use the SUM() I also have to use the GROUP BY, only that I am not able to make the sum. I don’t know which fields I…
-
1
votes1
answer225
viewsselect distinct in temporal table sql server
I have the following code: (is from a table that the representatives have the same code, which generates duplicated values, I solve this by taking the most current representative, in short the last…
-
1
votes2
answers324
viewsSQL Select return only one of several
have two tables. Table "user" which has 5 lines and 5 users. is the "location" table that has 20 records, using 5 Foreign key of user table ID When I use this select I made select u.nome from…
-
1
votes1
answer240
viewsQuery joining two tables and filling in fields conditionally
I’m a beginner in SQL and I was wondering if you could help me with a question. I have two tables, one is called Cadastro_func and the other Cadastre. The 'Func_register' has the columns: 'Nickname'…
-
1
votes1
answer41
viewsMore than one value in an id variable
Select: <div class="span2" class="checks" > <h4>BRANCO</h4> <img src= "/images/cor-05.jpg" width="57" height="27"> <input type="checkbox" data-id="TRANSPARENTE"…