Most voted "sql" questions
Structured Query Language (SQL) is a language to query databases. Questions should include examples of table code and structure. This tag refers to the default language, not to be used for questions about the implementation of specific DBMS (such as Mysql, Postgresql, Oracle, MS SQL Server). In this case use the specific DBMS tag. Answers to questions marked with ANSI SQL should use SQL as much as possible.
Learn more…6,771 questions
Sort by count of
-
0
votes0
answers50
viewsProblem with database connection
My group are doing a Java project with database and while continuing the project on other machines only appeared problems only in mine that is giving the following error when trying to make the…
-
0
votes1
answer1414
viewsSQL Server - Line Break
Good morning, thank you for the time in reading that question. Problem ! Consider the registration line ID | Nome 1 | "Fulano 1, Fulano 2, Fulano 3, Fulano 4" I need to mount a select that when it…
-
0
votes1
answer177
viewssub-query with main query parameter
I have this query: SELECT id_arquivo, nome_arquivo, etapa, em_uso, em_uso_por, processo_concluido, obs_temp_etapa_atual, cod_funcionario_dev, status_devolucao, devolvido_por,…
-
0
votes1
answer42
viewsSELECT in 3 database tables with specifications
I have three tables in the bank, one for companies, another for employees and another for guides. I am trying to make a SELECT that brings all companies that have any employee linked to it (there is…
-
0
votes1
answer26
viewsHow to run a code block from a number of specific items recorded in the table?
I didn’t know how to summarize the question, but here’s the thing: I have a table (SQL) where there are columns nome and data. There with PHP, I want to check the number of the week from the date…
-
0
votes1
answer36
viewsSQL for specific page
I’m making my own paging code from a table of records, and in my case I don’t want only the requested page to come by AJAX instead of all pages to be manipulated by Javascript. The information of…
-
0
votes1
answer354
viewsDoubt when mounting a Where in a Procedure
On the site, I have a filter that already works. This filter will be maintained, but the table will be another, from another bank including. The rule for the filter is, if the parameter passed is:…
-
0
votes1
answer241
viewsHow to update a dataframe column in R using joins without creating another object?
Rapazeada blz? Guy I am Newbie in R and I wonder if it is possible to update a data.frame in R by making key with another data.frame, the analogy in tsql would be this: Update a Set a.col1 = b.col2…
-
0
votes0
answers23
viewsValues in certain ID’s are visible in the bank but are not visible in the recipient
I am trying to enter a list of data, however, in a certain period some ID’s are not being sent to the recipient. I can verify in sql that the entered values exist, but are not visible (or do not…
sqlasked 5 years, 7 months ago Rafael Holanda 1 -
0
votes1
answer77
viewsChecked radio button with sql query listing
Good afternoon, I have an appointment that calls me back radio buttons with some BD results for further handling, however when I put the checked it is marked in the last table result, how can I make…
-
0
votes1
answer504
viewsInsert array into database using PHP and SQL
I’m trying to insert values from a array inside the database using PHP, but I’m having difficulty in the applied method. It’s the first time I use arrays for that reason. My current code is:…
-
0
votes2
answers995
viewsis not a GROUP BY expression
Hello . I am trying to execute a certain Query on Oracle and I am getting the following error : "is not a GROUP BY expression". Below is the list of tables and query: BILL NRO_CONTA|COD_AGENCIA|NOME…
-
0
votes1
answer649
viewsSQL De-to joining different data
I have an appointment taking away my patience, I have to join two tables of different years, but the reference codes changed from one year to another. How do I keep information on the same line.…
-
0
votes2
answers301
viewsSELECT LAST_INSERT_ID() always returns 0
I have the following codes: public async Task EnviaMySQL<T>(string sql,bool pass = false, string file = "SqlJson.php") { if(!pass) Utils.Acoes.Load.ShowLoad(); var result = ""; var lista = new…
-
0
votes0
answers66
viewsLimitations in an SQL query
I have to make a report that shows the main customers of each seller (the top 10 customers who spent on each seller) I am using the Oracle database to make this query. Each seller has more than 40…
-
0
votes4
answers587
viewsHow to correctly send the value of a null variable in an INSERT?
Assuming I have the following code: public async void InsertBanco(string parametro1, string parametro2) { var b = new BancoN(); SetBanco(b); await b.EnviaMySQLInsert($"INSERT INTO tabela(parametro1,…
-
0
votes1
answer105
viewsusing CAST in INNER
Good morning I’m trying to make a mistake but Join. string Query = "Select rec.chvbfj, rec.doc, vndB.chvvnd, vndB.chvps, ps.chvps, ps.Dsc " + "From (( " + "rec " + "inner join vndB " + "on…
-
0
votes1
answer481
viewsError Invalid 'EXAMPLE' column in the selection list because it is not contained in an aggregation function or in the GROUP BY clause
Hello, friends. I am trying to perform a query on SQL SERVER that worked perfectly on Sqlite. Does anyone know how to make it work? Consultation: SELECT B.CLIENTE, A.CODCLI, SUM(A.VALOR-A.VALORPAGO)…
-
0
votes1
answer59
viewsSQL Summing all values, how to break by blocks
I have a table that stores financial values per month, I need to display by year, I made a SUM and it worked when I have only one project registered, when I have more than one project it sums up all…
-
0
votes2
answers54
viewsHelp with Query Mysql
I have the following query: select profissionais_ab.cns cns_medico, profissionais_ab.cbo, unidade_ab.nome from profissionais_ab join unidade_ab on unidade_ab.id = profissionais_ab.unidade_id Return…
-
0
votes2
answers152
viewsHow to make a text field mandatory when one of the radio Buttons is selected?
I intend to make the field "Idsiliamb" mandatory, only when the radio button "Company" is selected, if the field "Private" is selected nothing will happen. At the moment when I select the radio…
-
0
votes1
answer110
viewsI found this in my error logs, a hack attempt?
I found this in my error logs and security search, yet I’ll study, but maybe someone has seen? 1 attempt The codes were captured from a connection and taken from PHP’s GLOBAL $_SERVER with the…
-
0
votes0
answers105
viewsWhy doesn’t my select return in PHP?
I have a PHP query which is as follows: <?php $serverName = "servidor"; $connectionInfo = array( "Database"=>"banco", "UID"=>"user", "PWD"=>"senha"); $conn = sqlsrv_connect( $serverName,…
-
0
votes1
answer116
views -
0
votes0
answers63
viewsPaging does not work
I just did the research field and paging of my project, however I have 17 records already added but only has 8 records I made the code in order to present 15 records per page, that is, on the second…
-
0
votes2
answers1811
viewsI cannot access my Mysql Mariadb database
I’m on Linux Deepin 15.19 and installed for Web Development, however when I can’t create new databases by Mysql Worckbench say: Your Connection Attempt failed for user 'root' from your host to…
-
0
votes0
answers64
viewsHow to use two Join followed SQL
How can I use two joins in a row, and the second will use the table data generated by the first? I want it to relate the Join by the same data, where in the first Join it unites the data of table A…
-
0
votes1
answer74
viewsJoin that shows multiple data from one id
I have 3 tables: "Third parties", "Address third", "Contacts third party". The goal was: a third party would be inserted, it would be listed, it would be assigned an address and a contact, however I…
-
0
votes1
answer69
viewsSelect different conditions for the same column
I have the following table with my current query. Data | PesoTotal 01/04/2019 | 500 02/04/2019 | 800 And I would like to add a new column (Pesohorario), which would be the Peso on the date, but…
-
0
votes1
answer373
viewsRemove partition from table
Using the mysql documentation, I created the partition based on a year field. ALTER TABLE minhatabela PARTITION BY HASH (ano_referencia) PARTITIONS 10 To make a possible rollback, how I would drop…
-
0
votes2
answers217
views -
0
votes2
answers70
viewsUnidentified database: "No database Selected"
I’m making a shopping cart file. The code is apparently correct, but when including the file connecting to the database, the browser displays the message "In the database". Note: Both the file,…
-
0
votes0
answers696
viewsCannot read Property 'Name"' of Undefined at Object.Val [as updateDirectives]
I’m doing an Asp.Net Core Web API with Angular 7 CRUD and I’m having trouble in the final phase, just when I enter my angular localhost and open the console, I come across the following log (Note,…
-
0
votes1
answer92
viewsHow to Recover C# Dynamic Fields for SQL
I’m making an ASP site that has dynamic fields in js: a = 0; function GetDynamicTextBox(value) { a++; return '<div class="container bg-light p-3 mb-2"><div class="form-group row…
-
0
votes1
answer100
viewsMultiple references to a FK in the same column/row
Good afternoon colleagues, I would like a help to model a comic, the doubt is as follows: Is it possible to have more than one FK ID on a tuple? EX: tabela teste1 |id_teste1|id_teste2|teste|teste01|…
-
0
votes0
answers91
views -
0
votes1
answer167
viewsError When Mapping Idatareader with Automapper
I have this typing error when trying to map a Sqldatareader coming from a previous, mapping with Automapper Error An unhandled Exception of type 'Automapper.Automappermappingexception' occurred in…
-
0
votes2
answers412
viewsSql Server - Does checking for field NOT work if to avoid select?
Please consider the script below.. He checks if there’s such a thing in a table, if there is one, he selects it. Then check again if it exists (only for didactic fims ;) and existing Dropa the…
-
0
votes1
answer284
viewsOracle SQL - select only clients with more than one order, listing items from two ID tables, EMAIL and ID_ORDER
I have two tables: table CUSTOMERS ----------------------------------- ID_ | EMAIL 01 | [email protected] 02 | [email protected] 03 | [email protected] table ORDERS…
-
0
votes1
answer39
viewsSQL subquery - Replicated values
I am working with 3 tables, the SUPPLIED table contains the name and code of the suppliers and the other two tables have the data I want to work. The problem is when I try to make a loop so I can…
sqlasked 5 years, 6 months ago Kratos Deus da Guerra 1 -
0
votes1
answer573
viewsIs there any kind of IFERROR in SQL Server?
Assuming the following script: DECLARE @var1 VARCHAR(100) = 'Stackoverflow'; DECLARE @var2 VARCHAR(100) = '10'; SELECT 1 * @var1; SELECT 1 * @var2; If you execute the first select, we will receive…
-
0
votes1
answer94
viewsInner John and Left John problem
I am using the Postgresql + C database# I have a Type that we can call Main. Inside it I have a long id, string name, I have a Classea, Classeb, Classec. Both the Classea, Classeb, Classec may or…
-
0
votes3
answers55
viewsSwitch between results
Hello! I have the following appointments: SELECT id, nome, idade, data_nascimento, cpf FROM internos WHERE cpf = '12345678911' and SELECT id, nome, idade, data_nascimento, cpf FROM externos WHERE…
-
0
votes1
answer24
viewsCount quantities of a given attribute within a table
all right? I have the following question, I created a database for a card game in the style of Magic. I have a table that shows the skills and another that shows the cards and, another one that I…
-
0
votes1
answer207
viewsCase When with Leftjoin
Can someone give me a hand, I’ve spent hours trying to make this query work: SELECT p.id as idPedido, p.*, i.*, e.*, f.*, m.id AS idEmpresa, m.razao_social, l.id AS idFilial, l.razao_social AS rsf,…
-
0
votes1
answer174
viewsSelect Distinct in only one of the tables
I have the following separate tables, A and B which I am placing next to each other to facilitate: +--------------+------------+-------------+ |ID Relacional | A | B |…
-
0
votes0
answers114
viewsCould not find specified column in Results
I have a code to search in two tables, a search the logo and the other the images, the first he does normally, does the reading and everything else, in the second he already error, the code is as…
-
0
votes1
answer187
viewsQuery mysql rows for columns
Hi, I know there are some similar questions here already, but none of them helped me. I have the following table in my database: +----------+---------------+--------+ | id_bolao | data_concurso |…
-
0
votes1
answer439
viewsOptimize 20 Million registry mysql database
Create code: CREATE TABLE `tb_empresas_ativas` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cpf` varchar(255) DEFAULT NULL, `nome_cliente` varchar(255) DEFAULT NULL, `razao_social` varchar(355) DEFAULT…
-
0
votes1
answer66
viewsHow to concatenate an SQL Server statement?
I have a table in SQL Server Management Studio in which I have the fields test | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 Create a for loop in Visual Studio’s C# in another table that counted how many…