Most voted "select-sql" questions
SELECT is an SQL statement that returns zero or more rows, from one or more base tables, temporary tables, or views in a database.
Learn more…241 questions
Sort by count of
-
0
votes0
answers35
viewsShow only 1 record at a time with go to next button
Good night to you all. I would like to: Show records sequentially, (1 at a time), on a web page for a set of more than 100,000 records. I can show all at once, but I would like to only 1 at a time…
-
0
votes1
answer32
viewsGroup By com sql server
I am trying to group the data of my select , according to the field C9_CARGA , however when I run this select it returns me without being grouped , I believe I am doing something wrong . How are you…
-
0
votes1
answer44
viewsQuery MYSQL does not order correctly
Hello. I have the following query: SELECT * from usuarios_cursos_matriculados LEFT JOIN cursos ON cursos.cedoc_doc_id_fk = usuarios_cursos_matriculados.cedoc_doc_id_fk LEFT JOIN cedoc_doc ON…
-
0
votes2
answers44
viewsHOW TO ADD UP THE VALUE OF A PRO CLIENT COLUMN
Good afternoon Gentlemen, In benefit of my studies I am developing a simple sales system and I am already in the part of the reports. My doubt is as follows: How to make a select adding up the…
-
0
votes1
answer786
viewsHow to join these two selects of the same table in SQL server?
Next, I need the amount per month of each customer who entered the year managed to do this, however I want q be shown in only 1 result. How do I join the two SELECTS? In order that it is added to…
-
0
votes1
answer260
viewsMultiply two columns in a select With Groupby
How Can I Do This Multiplication? the table looks like this: What has to be done is to group disciplines 11 and 13, count how many 'sit' F and Null have and multiply by 'qntd_aula'... I managed to…
-
0
votes1
answer85
viewsHow to condition select in another table row in Mysql?
I’m a beginner when it comes to Mysql language and I’m trying to filter some information I need to get out of a table. Basically I have data of individuals in consecutive years (2003, 2004, 2005)…
-
0
votes1
answer28
viewshow to use the SELECT statement to be inserted in a column in the same table?
SELECT Names,SUBSTRING(Names,10,50) AS Alias FROM NameToSplit; Here I do not want to put the Aliases, but INSERT in the column Alias this Select statement. then I need to take this column Alias and…
-
0
votes1
answer47
viewsError while performing max(sum())
I’m trying to solve the problem to find the state with the largest number of cities starting with saint/saint. For that I realized this view: CREATE VIEW SANT AS ( SELECT E.NOME ESTADOS, M.NOME…
-
0
votes1
answer229
viewsMYSQL - The used SELECT statements have a Different number of Columns
I have a Mail Query that returns a result that does not contain some data I need, like LOC_NU, LOC_NUM_SUB and MUN_NU. Follow the original NO these fields and no errors: select…
-
0
votes0
answers627
viewsQuery Mysql: Error Code: 2013. Lost Connection to Mysql server During query
I have a Mysql Query that only returns me Error Code: 2013. Lost connection to MySQL server during query. Follows the same: select log_logradouro.ufe_sg, log_localidade.LOC_NU,…
-
0
votes1
answer20
viewsImplementing view
Display statement of a particular account with the respective movements of a 15 days prior to the request date with the following data: Agency; Account number; Name of the account holder; Account…
-
0
votes2
answers127
viewsSELECT LIST returns only one value and not a list
Hello, I have two tables, one representing the groups (Certification.certification_adm_email - columns start with "fall"), and the other users (admin.dbuser - columns start with "user"). Among them…
-
0
votes1
answer118
viewsTypeerror: fetchall() takes in Arguments (1 Given)
When running the code below I get the title error, I tried to use a different code structure by assigning the results of select to a ma variable, tried tbm just bring a bank line with fetchone() and…
-
0
votes1
answer41
viewsSelect works perfectly, but when it is passed as function returns error
I’m facing a dilemma that seems to be simple to solve, but I can’t see where the error is. I have a SELECT COUNT(*) that works correctly, but when it is passed as a function the error occurs…
-
0
votes2
answers33
viewsSelect in 3 tables returning multiple Oids
Script only works by returning a single codpro (4609), needed it to return several SELECT a.filial, a.codpro, b.descricaolonga , a.quant, a.estminimo, c.filial AS 'filial ped', c.quant AS…
-
0
votes1
answer20
viewsI need to create a sequence of equal numbers within two columns in the bank
Hello guys I’m new with mysql code manipulation, I need to help to create a numerical sequence in the registration and registration columns, note: the records have to be equal in both columns! Note:…
-
0
votes0
answers28
viewsSelect with field of the same name between two tables without connection however approximate values
I have the 3 tables, 'users_teste', 'nps' and 'product', the product table has no relation with the other 2 tables, I need to perform a search comparing the request of the table 'nps' with the…
-
0
votes0
answers19
viewsHow to make an Insert with select using bdlink
I need to do an Insert along with select looking for data from another database, for this I’m using dblink, but I’m not getting, I use pgadmin4 declare insertCad RECORD; begin for insertCad in…
-
-1
votes1
answer401
viewsDisplay only landline and mobile phones with type 9 in front
Following I have a table called telefonia_numero and within it is a field called Numero where contains all user phone. Ex . Jose - Number 81 3636-1145, 81 99873-7787 and 9873-7787, Here comes what I…
-
-1
votes1
answer438
viewsHow to select N records in a select in Oracle plsql?
I have 3 tbs, I make the following catch the id of tb1 in common with tb2 and tb3(id ), then compare if field 1 of tb1(LENGTH) is larger than field 1 of t2, in tbs 1 and 2 there are several ids of…
-
-1
votes1
answer1839
viewsSQL To Count If Greater Than 1
My problem is this: I have to make a condition if the SEQ_VENDA has more than 001 NUMERO, it bring the SELECT data. And if you only have 1 NUMBER for SEQ_VENDA do not bring in SQL…
-
-1
votes1
answer274
viewsHow to make Select from all table ids except the first 2?
I need to make a select in mysql of all users of a table, but I cannot receive the first two users of the table and I need to do this without specifying id, since when more users are registered I…
-
-1
votes2
answers458
views"expects Parameter 2 to be Resource" error when connecting to the database
I am trying to make a connection via php to a mysql server but always presents the following error: Warning: mysql_select_db() expects Parameter 2 to be Resource, null Given in…
-
-1
votes1
answer25
viewsTwo tables using Where
I have the ID of a user who is in $user. I have two tables. Table A (contains questions) coluna idA coluna perguntaA Table B (stores the id of a question answered by a user) coluna idB coluna…
-
-1
votes1
answer125
viewsHello, I have a database - mysql and would like to decrease a value in an entire column
I’d like to use the command update to decrease an hour in the values you already have in the table of several values in the whole column. EX: Nome da Coluna Gostaria da coluna assim HORA HORA 13:45…
-
-1
votes2
answers36
viewsDelete only if there is - in the word
I would like to delete some useless records from my database They are, for example: -2046820062 -2046820165 -2046820183 In short, all records that start with the symbol - (less) of my data2 column…
-
-1
votes3
answers64
viewsHow to filter only numbers with 'Like' SQL
I have a table in which the field mainUnitId has the following data: Ad23 Ad7 Ad11 Ad9 Adv1 Adv14 Adv21 I need to bring in the search only those who have Ad + numbers after My code: SELECT * FROM…
-
-1
votes2
answers5049
viewsCheck if record exists in the table and return in mysqli
Hello I have a table called logs id | usuario_id | produto_id 1 | 10 | 20 2 | 10 | 30 3 | 20 | 30 4 | 20 | 20 They are logs stating that the user with id 10 has already seen the product with id 20,…
-
-1
votes1
answer23
viewsMysql query does not complete the search for all BLOB fields
Good afternoon. I have a problem that I don’t know what it is. What happens is that I have a list of clients and each client has a mug shot. (Is around 2000 customers) In my application I do 2 types…
-
-1
votes1
answer79
viewsReturn of several CASE in a single line
How do I convert that return: In a single line: 548721 125 2 20836 20836 77821 77821 9999******9999 0 0 MASTERCARD 200 Cartao de Credito a Vista My query: SELECT CASE data_id WHEN 17 THEN data_value…
-
-1
votes3
answers376
viewsMYSQL Insert into com Where not exists
Staff I have the following situation, I have 2 tables, I need to insert in table B data that are in table A, however, should be checked if the data that are in table A already exist in table B, if…
-
-1
votes1
answer21
viewsDuplicate results
I have two tables product:{ pid namesake value category stock Eston stocking } pictures{ fid name product } And I’m trying to make a query in the bank where I need to take everything that is in the…
-
-1
votes1
answer18
viewsHow can I count the number of Records in Mysql?
I have this Mysql code: SELECT COUNT( PEDIDO.COD_PEDIDO ) FROM PEDIDO JOIN PEDIDO P2 ON P2.COD_CLIENTE = PEDIDO.COD_CLIENTE AND DATE( PEDIDO.DT_PEDIDO ) = DATE( P2.DT_PEDIDO ) AND PEDIDO.COD_PEDIDO…
-
-2
votes1
answer120
viewsSELECT Mysql with wrong result
Let’s take the table below as an example: id empresa forneedor 1 10 105 2 10 102 3 10 105 4 10 112 5 10 105 Using company and supplier as indexes. Making SELECT * FROM table WHERE empresa = 10;…
-
-2
votes1
answer63
viewsSelect COUNT > 10K in C# and SQL
I would like to select in records greater than 10 thousand and delete after. select count (FuncionarioID) > 10000 FROM FuncionarioLog; How should I select correctly?…
-
-2
votes1
answer57
viewswhere do I use left Join in this case? no msql
I need to put the left join in which case here you can tell me where the mistake is? select a.nome_artista, count(*) as numero_musicas from artista a, musica m where m.id_artista = a.id_artista…
-
-2
votes2
answers121
viewsSelect higher value between Mysql Joins
Hello. I need to make a query in Mysql where there are JOINS of 4 tables, all tables have the column data_cadaster, I need the selection to return only the record where the data_cadaster is the…
-
-3
votes2
answers58
viewsData conversion in SQL server after using in Where clause?
I need to extract sales from such a date period until such date. For example, between 01/04/2011 and 30/04/2011. I am not able to bring the result of the period in question. In this case, I am using…
-
-3
votes2
answers36
viewsHow to take selected value from Dropdown Menu and insert into a PHP variable?
I have the following dropdown menus on my website: <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12"…
-
-4
votes1
answer21
viewsSELECT TWO COLUMNS THAT HAVE THE SAME ID IN DIFFERENT TABLES AND MAKE COMPARISONS
Good night Devs, I need to take each actor_id and film_id and check which total of movies(filme_id) has linked to actor_id and this I got : SELECT actor_id, COUNT(film_id) from film_actor group by…