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
answer1722
viewsError Code: 1048, SQL State: 23000 Column 'colegiado_id' cannot be null
Hello, this mistake "[Error Code: 1048, SQL State: 23000] Column 'colegiado_id' cannot be null" happens when I try to run the SQL command below directly in Mysql: start transaction; INSERT INTO…
-
0
votes3
answers86
viewsError while selecting select text
Good evening, folks. I have a select that lists the cities of the respective state. I’m using this code to select a city from the list: $('#txtCidades…
-
0
votes1
answer449
views -
0
votes1
answer172
viewsSelect with JOIN to return an Object with Internal List
I wonder if it is possible to select with Join where the second table will return more than one row and in that create an object with an internal list. For clarity see the example: Tabela Usuario:…
-
0
votes1
answer1468
viewsHow to mount a Select to join columns
I’m having a doubt I don’t even know if it’s possible: I would like to perform a select that joins two columns. Otherwise it would be: Person table with the cod_person fields - name - rg -…
-
0
votes1
answer339
viewsHow not to select records that are within a date?
I have a table in Mysql with apartment, so: id | nome | data_ja_locado 1 | ap teste | 09/08/2015, 10/08/2015, 11/08/2015 So when the user does a search he wants to find apartments that are available…
-
0
votes1
answer476
viewsSelect Format yyyyyy-MM-dd HH:mm:ss in MYSQL table column
Date 2014-12-01 10:52:38 2014-12-01 10:52:14 2014-12-01 10:51:57 2014-12-01 10:35:34 2014-12-01 10:23:17 2014-12-01 10:22:18 2014-12-01 09:03:49 2014-12-01 08:53:51 I have this column with these…
-
0
votes1
answer9931
viewsSelect like (2 different parameters)
I have a table with several cars, I need to get only the ones I need. Example: goal fox Parati Kombi Voyage I want to catch only goal and Kombi. I am using the following command to pick up where GOL…
-
0
votes2
answers101
viewsHow to remove the sub node from a list of a select
I have a responsive menu on my site that some options should not appear when viewed through mobile. <ul class="sf-menu"> <li><a href="#lk1">A gente!</a> <ul>…
-
0
votes1
answer993
viewsAndroid sqlite - Return _id logged in Listview only one value selected using Where condition
Good evening guys, I’m new here, I’m new to Android programming, but I decided to do my TCC, a project on Android. by doing alone, finding material on the Internet, without taking Android lessons,…
-
0
votes1
answer72
viewsIs it possible to reuse this complex function for multiple registrations at the same time?
On the site I took over from a previous developer, the investor registration is done one by one after a search in the system called CM. The function is called cadastralInvestidor: function…
-
0
votes3
answers239
viewsPick up a single record for equal columns
I have an example table: produto | supermercado ---------------------------- 1 | 1 4 | 2 6 | 1 5 | 1 8 | 2 7 | 3 I want to get all existing supermarkets in this table, without picking up repeat…
-
0
votes1
answer583
viewsDynamically load contents via <select> tag
I have a question, and I wish you could help me. My case is the following I have a dynamic where according to the selected option it returns a JSON with information from Hotel Units. What I need is…
-
0
votes0
answers40
viewsSelect and calculate hours with datatype varchar
Hello, by date, I need to make the longest hour minus the shortest hour of X people. 1 How to select the largest and smallest by a date? I have tried a lot, I can post here the attempts. 2 The data…
-
0
votes2
answers4855
viewsHow Select SUM(',''',''''')
Personal I’m just with a doubt, about how the mysql select works. Select SUM(IF('','','')) I’m using it but I don’t really know how it works
-
0
votes1
answer96
viewsDifference between texts with multiple paragraphs in Mysql
I have two fields in the table (text) that receive several lines (paragraphs) of information, for example: CAMPO1 linha1 linha2 linha4 linha5 CAMPO2 linha1 linha2 linha3 linha4 I need to check which…
-
0
votes1
answer448
viewsHow to Select a table row and display information in another table relative to the table?
I’m using this code, but I’m not connecting it properly... I would like to register Payments (payments) for these to appear only when selecting the partner in the table(socio)... String sql =…
-
0
votes1
answer59
viewsSelect multiple to avoid 2 database queries
I have the following select (using PDO): $usuariosListados = $pdo->prepare("SELECT user_1, user_2 FROM usuarios WHERE user_1 = '".$_SESSION["usuario"]."' AND estatus = 2"); $usuariosListados…
-
0
votes0
answers107
viewsSelect Advanced separated by hour
I rode a SELECT to return some information from my table separated by time and date. Until this part is all working correctly. Now I need him to select the same data only from another date, being…
-
0
votes2
answers363
viewsCalling value from another page
Hi, guys. I’m having a little problem with passing data from one page to another. I’ve tried by Session and not quite sure and I’ll explain why: I have a news page that distributes them by a for in…
-
0
votes2
answers57
viewsDo a search for my site in two tables
I need to do a search for my site in which I returned first the companies that have something similar to typed and, right below, show all registered products with something similar to typed. I have…
-
0
votes1
answer23
viewsSelect manual in repository using Spring?
Hello, I wonder if there is a way to make a select within the Repository, I’m using Spring and REST, I need to return all entities that have another entity, I would take them by id, and I need to…
-
0
votes2
answers761
viewsFirebird - Select to join two or more lines
I have a table with the following structure: Cliente_id | credito | debito | pedido 1 100 1 1 150 1 1 30 1 2 200 2 2 180 2 How to make a Select that the result is similar to the below? Cliente_id |…
-
0
votes0
answers1189
viewsSelect SUM within another select MYSQL
This query is already working: SELECT itens.setor, xregras.nsetor, itens.grupo, xregras.ngrupo, itens.conta, xregras.nconta, itens.dotacao, sum(IF(tipo = 'ES',total,0.00)) as efetivado, sum(IF(tipo…
-
0
votes0
answers43
viewsSelecting sets of JPA values
I have the following problem: I have a table with a list of values for a composite key. Following example: ID | ItemCode | Localidade | Preco ---+----------+------------+------- 01 | 001 | 001 | 3.5…
-
0
votes1
answer109
viewsMount Dynamic Playlist With Select Option
I intend to create several "Play List" using an element select, instead of leaving it in the body of html document, want to put in a file "js" external, and call each "Play List" through a "Search…
-
0
votes2
answers565
viewsFirebird Select Query using same field twice
I have a field called patiente_id, I want to create a select +- like this select count(paciente_id where = 0), count(paciente_id where <> 0) from agenda I don’t know it was clear, but I want…
-
0
votes1
answer58
viewsSelect in mysql from such Input
I am making a query in the database and have to return the table from such index. for example: | Ind | value | |001| AAA | |002| BBB | |003| CCC | |004| DDD | |005| EEA | |006| FFF | |007| GGG |…
-
0
votes1
answer309
viewsHow to create a sub-select in oracle in a composite key table?
The table has a composite primary key, and the fields are a date (ID_DEPURACAO) and a number(SEQ_DEPURACAO). What I want to do is a sub-select that takes only data greater than a given date and that…
-
0
votes1
answer62
viewscreate php/oracle view
I intend to generate a view through php to an oracle database where select is done through the result of another query. This query mounts select to view: $sql1 = "SELECT TESTE FROM VIEW_TESTE";…
-
0
votes2
answers170
viewsI cannot update because it is not recovering php Pdo id
Here is to recover in html: if(isset($_GET["id"])){ $administrador = new Administrador(); $mostrar = $administrador->listar_id($_GET["id"]); } <form action="Crud.php" method="post"…
-
0
votes2
answers555
viewsSelect in Mysql by skipping simple quotes
Hello How can I use this select and skip value with simple quotation mark? . . .st.executeQuery("select * from tabela_A where id = uc"); rs = st.getResultSet(); while (rs.next()) { texto =…
-
0
votes2
answers764
viewsHow to query data from a table using INNER JOIN in a sub-query in PHP
I have the following SELECT to select data from a table (chat) in a chat system: SELECT * FROM (SELECT * FROM chat WHERE id_chat = '$chat_id' ORDER BY id DESC LIMIT 10) S WHERE id_chat = '$chat_id'…
-
0
votes1
answer391
views -
0
votes1
answer24684
viewsSelect in two tables at the same time
I have the author and sentence tables: autor: autor_id | autor_nome 1 | joão 2 | pedro frase: frase_id | frase_frases |autor_id 1 | frase do joão | 1 2 | frase do pedro | 2 3 | frase do pedro | 2 4…
-
0
votes2
answers974
viewsHow to make a datagridview C# sort a list (Ilist) by clicking on the grid header?
How to make a Datagridview C# sort a list (Ilist) by clicking on the grid header? For example, I have a list with three fields (id, name, city), when the user click on the column name, I want to…
-
0
votes1
answer635
viewsSelect with Join in Codeigniter
I have a question in a select with the use of Join in codeigniter, follows: I have 2 tables. tabela jogo id | id_time1 | id_time2 99 | 1 | 2 tabela time id | time 1 | Real 2 | Barcelona I want to…
-
0
votes1
answer814
viewsIs there any way to merge multiple SELECTS into just one query?
I have a page where I will have to make several queries to the bank. At the moment, they are a total of three tables. They are: cadastro, publicacoes and estilo. Currently I do as follows: SELECT…
-
0
votes1
answer39
viewsSelect deleted a record and searching for others with the same code
The product code I pass to sql via php. For example $cd_product = 2; I would like to list everything but the product record (cd_product != 2). So far so good. However I would also like only the…
-
0
votes1
answer64
viewsList the post owner and the last user you commented on. Mysql
Eai guys, I have the following query below, where I list all posts, amount of comments and the user who created it, but also wanted to list the last user who commented each post, will be able to do…
-
0
votes1
answer150
viewsQuery is returning an empty array (Mysql/Wordpress)
How do I get the field values meta_value = candidate of this table. I’m using this query, but it’s returning an empty array. $resultados2 = $wpdb->get_results( "SELECT * FROM $wpdb->usermeta…
-
0
votes1
answer75
viewsFine-tuning Ranking for a Game System
I have a very crazy problem that has already burned my logic ability. A while ago I posted a question almost like this but and they helped me a lot (I really appreciate it) but my need changed and…
-
0
votes0
answers71
viewsQuery with sql does not return when using WHERE
I have a query that should bring the name of users who received a message sent by a user: SELECT msg.msg_content ,usr.user_name FROM message AS msg INNER JOIN usuarios AS usr ON msg.user_id_out =…
-
0
votes0
answers364
viewsTraverse all strings by delimiter in the field and generate a column with the result
SET @contador := 0; SELECT SUBSTRING_INDEX( SUBSTRING_INDEX("BOX 01;BOX 02;BOX 03;BOX 04;BOX 05;BOX 06;BOX 07;BOX 08;BOX 09;BOX 10;BOX 11;BOX 12;BOX 13;BOX 14;BOX 15;BOX 16;BOX 17;BOX 18;BOX 19;BOX…
-
0
votes1
answer40
viewsSelect Mutiplos Mysql
I need to search data from one table and complete with data from another table... Main table: agendaphone Secondary table: neighborhood principal:…
-
0
votes1
answer1685
viewsC# - Display search results in Datagridview (SELECT SQL)
Hello! I’m actually starting at C# and I already have small projects. I can already connect to the remote database, I can already run queries, I just can’t get the result of a Select and show in a…
-
0
votes1
answer27
viewsSelect some data from different tables
Reborn the programmer around here, I’m having trouble with SQL and ask for help. I have two tables called orcamentos and clientes. I need to select all fields in the table orcamentos and only the…
-
0
votes1
answer61
viewsSelect from different tables
How to select from different tables? Type, check if there is value in one, if not, check in the other.
-
0
votes2
answers1184
viewsHow to update select with jQuery
Hello. I have a select <div class="seletor"> <select name="numeros" id="numeros"> <option value="1" selected="selected">1</option> <option value="2">2</option>…
-
0
votes1
answer166
viewsHow to select the value option returned with jQuery?
This variable Uf data. me returns the acronym of the states. Ex...: SC How I make a loop with jQuery to select the date-symbol correlately to the variable Uf data.? <select id="billing:region_id"…