Most voted "query" questions
Query or *query* refers to the act of recovering data previously stored in a computerised system from certain parameters and/or filters, by means of a specific command or operator.
Learn more…1,160 questions
Sort by count of
-
0
votes1
answer413
viewsHow to use pseudonyms in queries using Aliases along with Mysql?
I would like to be able to use the Alias 'AS' along with mysql without having to do query alignment, that is, I want the secondary queries to be named to use them in the main query, it is possible?…
-
0
votes1
answer100
viewsLimit the number of requests in the query
Possuo is query that makes one request at a time, in random order. $sql = "SELECT * FROM `viperusers` WHERE vip < 1 AND username != :username ORDER BY RAND() LIMIT 1"; Explaining, I select all my…
-
0
votes1
answer123
viewsSql does not return column name
I have two tables a TEAM another MATCH_DETAILS. The table TEAM has the spine id and is a primary key. I made two table reports TEAM for MATCH_DETAILS. In the MATCH_DETAILS assumed as foreign key…
-
0
votes1
answer920
viewsIt takes a long time to query in mysql
Hello friends I’m having a hard time finding what is wrong in my selection code (SELECT) in mysql, this taking more than 70sec do not know why. Someone there to help me please? Code: SELECT…
-
0
votes1
answer1542
viewsBring up column values and add up the total with php + mysql
I have the following script that brings the values I need, as I do for it also bring the total sum of $Row['value']? $results = $mysqli->query("SELECT * FROM cv_contratos_dependentes WHERE…
-
0
votes1
answer130
viewsMysql query to display records not linked to a particular company
I need to create a query on SQL. I have three tables: TABELA 1: EMPRESA emp_codigo (chave primaria) emp_nome TABELA 2: PALAVRAS_CHAVE pal_codigo (chave primaria) pal_nome TABELA 3: VINCULO…
-
0
votes1
answer1693
viewsGroup and add to a query in SQL Server
Good afternoon, I have the following problem: I’m developing a C# program for internal company data query. It is working perfectly, but I need to group field(s) and add another(s) that contains…
-
0
votes1
answer38
viewsSqlquery - Some Duplicate Records
Guys, in the query below is bringing the following way. UsuID Consultor Tentativa 1 Abertos 95093 Gabriela 96 However, it was to bring in the following way: UsuID Consultor Tentativa 2 Abertos 95093…
-
0
votes1
answer337
viewsCheck database changes correctly
I need to check changes in my database and create a script that sends requests every millisecond by calling a function that returns the number of lines in that database, but I realized that it is a…
-
0
votes1
answer795
viewsDivision between values - Query SQL Server 2012
Guys, in the query below, is bringing the following way. Ano Mes Horas total_horas 2018 1 107 766 H 2018 1 225 766 H Therefore, I want you to bring in another column the division of the column…
-
0
votes1
answer720
viewsSqlite error: Foreign key Mismatch (fk incompatibils) when trying to make an insert
I’m trying to create a Associative Entity (N:N) in Sqlite like this: [ Pet --< Vacinapet >--- Vaccine ] And, here is the code of my Associative Entity CREATE TABLE VACINAPET ( vp_data TEXT NOT…
-
0
votes0
answers183
viewsHow to not freeze/lock the application when querying data via SQL Server and create a "progress bar"?
The code below as an example brings me great information from the database. Every time I click on the "Search" option of my program, my application freezes/hangs for a while until the select "pull"…
-
0
votes0
answers40
viewsQuery - SQL Server with Stuff
Guys, in the query below I want you to bring it in the following way. contato andreia, marcos, juliana that is, on the same line. In the consultation, I used the stuff, but without success. Today…
-
0
votes1
answer767
viewsError running SUM - SQL Server
Guys, I’m trying to perform the SUM according to the query below, however, the following error occurs. " It is not possible to perform an aggregation function on an expression that contains an…
-
0
votes4
answers534
viewsHelp with distinct
I have the following sql query: select nome, data, situacao from cadastro The result is like this: MARIA 01/01/2018 0 MARIA 15/01/2018 1 GISELE 15/01/2018 0 CICERA 08/01/2018 1 ANTONIA 20/01/2018 0…
-
0
votes1
answer2207
viewsError convert Query SQL Server date and time
Guys, I’m trying to run the query below, however, the following error is occurring. " Failed to convert string date and/or time.". I have done some other conversions, but without success. select…
-
0
votes1
answer450
viewsI cannot recover id value through the POST method
I have the following functions: File registra_account.php: if(isset($_POST['acao'])){ if($_POST['acao'] == "inserir"){ inserirConta(); } if($_POST['acao'] == "alterar"){ alterarConta(); function…
-
0
votes1
answer68
viewsError while running script
Guys, I’m trying to run the query below, however, the following error occurs. "Conversion of a data type varchar into a data type datetime resulted in a value outside the range.". select…
-
0
votes2
answers410
viewsHow to merge these 2 SELECT into a single query
Good morning, I’m redoing the question because the last one I deleted was a little confused. I have these two select and would like to join them to return the result to a comparison chart. This…
-
0
votes1
answer177
viewsQuery works in phpmyadmin, but does not work in PHP
I’m trying to do a query via php in Mysql , but it’s not working in PHP, but it works in PHPMYADMIN. $check_in = strtotime($arrival); $check_out = strtotime($departure); Queries I’ve tried in PHP...…
-
0
votes1
answer289
viewsSet variable to null in a Query in php
I have the following QUERY on my system: $Query = "SELECT * FROM Monit WHERE ($Modulo IS NULL OR Modulo = '$Modulo') AND ($Usuario IS NULL OR Usuario = '$Usuario') AND ($Data IS NULL OR Data_reg =…
-
0
votes1
answer55
viewsSearch table field with query result from a different table?
I asked a question recently: Find lines of the last 24 hours that repeat the most (Mysql) And it was answered, now I have another question. I do the following to seek from and to of the most…
-
0
votes0
answers44
viewsWhat’s wrong with that method?
I’m creating an Asp net mvc application, I created a domain class with: public class Parcela { public int parcelaId { get; set; } public decimal valor { get; set; } public DateTime vencimento { get;…
-
0
votes1
answer158
viewsHow to echo the value of a variable from the query result
To automate my process of generating one JSON, i save the variable name in the database (Ex: $teste_value_1). In my php file. i have the value of this variable, for example $teste_value_1 = "Isso é…
-
0
votes1
answer40
viewsUse LEAD to catch the next date
I am trying to set up a query that will answer the following question: Number of customers (registration in the case) that has a reading date of 26 days, number of customers that has reading of 27…
-
0
votes1
answer21
viewsHelp with SQL query
I have 3 tables: enterprise: id integer nome string category: id integer idEmpresa integer nome string tag: id integer idEmpresa integer nome string I am consulting as follows: SELECT…
-
0
votes1
answer22
viewsPostgresql query bringing more results than expected
Hello, I have a situation in a system where I need to find out which student enrollments are related to a tutor in a class. The tables I have are: matricula containing foreign key with student…
-
0
votes0
answers202
viewsHow to pass the variable on postgres using dbblink
Oops, good morning! I have the following query in postgres: declare $1 VARCHAR; BEGIN IF (SELECT COUNT(*) FROM tempo2 WHERE looping IS NULL) > 0 THEN $1 = (SELECT banco FROM tempo2 WHERE looping…
-
0
votes1
answer46
viewsTrouble joining tables with UNION
I am trying to bring the top 3 of my table and also the last 2 placed, SITE TO EXECUTE SCRIPT This is my current progress that doesn’t work SELECT ('Podium: ' ||TEAM) as name FROM LEAGUE ORDER BY…
-
0
votes2
answers224
viewsMysql Query does not work with many arguments
I would like to request assistance from you identifying why my update query does not work. I have the following problem, the query below works normally: $conn->query("UPDATE dados_cadastrais SET…
-
0
votes1
answer102
viewsWhere de query using multiple list properties
I have the following scenario public Teste[] GetTestes(List<TesteDTO> testeDTOs){ IQueryble<Teste> query = GetAll<Teste>(); //where ... } public class Teste() { public int Prop1{…
-
0
votes1
answer138
viewsSQL - Searching XML data
I have a table in which one of the fields is an XML The XML structure is the Brazilian standard schema of CTE (Electronic Transport Knowledge) <cteProc xmlns="http://www.portalfiscal.inf.br/cte"…
-
0
votes1
answer29
viewsSubselect without condition WHERE
I need to do a list with sub select, and even managed to do it using a condition, however, I need it to occur without condition with the condition would look something like this: SELECT *,(SELECT…
-
0
votes0
answers212
viewsSubmit query on the same page of the form
I’m running a web application for a "Shared Races" (Uber type) service, where I want a CPF query to be presented on the green card. I want when I see the CPF, present on the green card, without…
-
0
votes1
answer133
viewsCatch record with JDBC SQL specification
Hello, good afternoon, sir. I’m having to develop a Java system with Mysql. It’s simple, just the part of the backend, but I’m inciante and had not run querys with java before hehe. The system is…
-
0
votes1
answer46
viewsQuery zeroing column when applying order by - Mysql
I am with a query that when ordering it in ASC it Zera a column of my table, but if I sort in DESC displays the values normally. This is the query: SELECT `tab_medicamentos`.`id`,…
-
0
votes0
answers108
viewsSubmit Ajax query on another page
Good morning. I’m making a shared racing web app, like "Uber". I want you to submit a query to the database with the list of registered drivers searching for Cpf, but I want you to show in this…
-
0
votes1
answer315
viewsRuby on Rails search to generate a report
Well I have a project with scaffolds of books and loans and I need to do a search of a specific book and as a result show all the loans that that book had I have no idea how to start doing that.…
-
0
votes3
answers113
viewsIs it possible to update to 1 table using another condition?
I have the following query: update ivr_contatos,ivr_campanha set ivr_contatos.tentativas = 0 where ivr_contatos.status = 0 and ivr_contatos.tentativas >= ivr_campanha.qtdtentativas the doubt is,…
-
0
votes1
answer285
viewsJSON in Laravel
I wanted to know how to send the data of the query in json through the controller and how the view should receive them. Controller: $dados = $req->all(); $query = ""; if($dados['filter'] == 1) {…
-
0
votes1
answer830
viewsHow to make SQL query using like comparator and various values out of order
I looked for answers here in the community, but I couldn’t find anything specific. I have a page where I can search the name of previously registered clients in a Mysql database. Currently, I am…
-
0
votes1
answer223
viewsHow can I get information using Lockable with chained Join?
I have 3 layers of entities, of which I only want the third object. but based on the information of the first 2. For example, I have manufactures that manufactures cars and each car has a kind of…
-
0
votes1
answer45
views2 calls to the same table in Sqlite (output different than expected)
Given the following 2 tables: CREATE TABLE IF NOT EXISTS sugestoes ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, texto VARCHAR(250), autor VARCHAR(250), itens VARCHAR(250), pontos INTEGER );…
-
0
votes2
answers533
viewsQuery data from two different tables and list without merging data
I am developing cash flow from my company and am encountering a difficulty. I have two different tables. One table is tb_compras(id, nfe, value, date) and then I have another also…
-
0
votes4
answers91
viewsSelect with columns stating incorrect data
Hello I’m having another problem with a database search. I want to make a SELECT that looks for information such as Cod.empresa, razaosocial, ano e valores(somados). At first, the search for…
-
0
votes1
answer227
viewsQuery Mysql three tables
I am trying to make a query in the MYSQL database, but the query is not getting back what I wanted. I want to make a query where return all modules and modules that the company has with the clause…
-
0
votes2
answers212
viewsSearch in lambda query with logical operators
I have a query for a report, where some search fields are optional, except the date ranges. However, when performing the query, the function always returns me values that do not match the parameters…
-
0
votes3
answers1026
viewsQuery SQL, Always show record of a repeating field first
I’m having difficulty listing only one line of each process. The query must always bring the protocols with the last revision. Ex: Show last revision 2 number process only and Show only last…
-
0
votes0
answers25
viewsFatal Error Executing the Query
I’m trying to do a while but I’m not getting it at all. It’s returning the error below: Fatal error: Call to a Member Function query() on null in /home2/techlogu/public_html/index.php on line 697 My…
-
0
votes1
answer36
viewsDelete two ID’s from different tables in the same query
Good afternoon! I have two tables: 1st question and second answer, and question_id is the key that allows connecting the two tables, being the foreign key in the "answer" table of the "question…