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
votes2
answers54
viewsQuery duplicate numeric field in sql server
Good morning! I have a table of notes and in the month of December there was a duplicity of several notes. These duplicated notes have different numbers, however, the total value of the note is…
-
0
votes0
answers73
viewsHow to execute a query using Python function
I set up a function that connects me to the BD and returns me a query: def consult(self, query): try: conn = mariadb.connect( user="XXXXX", password="XXXXX", host="192.168.000.000", port=3306,…
-
0
votes0
answers16
viewsI am unable to return complete data with adonisjs
Code of the Model 'use strict' const honorarios = require('../Metodos/honorarios') /** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */ const Model = use('Model') class ControleHonorario…
-
0
votes0
answers17
viewsQuery that returns the difference in hours between two dates considering working days - MYSQL
I have a demand where I need to generate a query that returns the amount of existing records in a table, given the difference, in hours, between two dates. The difference between the dates I can…
-
0
votes0
answers21
viewsMongoose - Filter by foreign ownership
Good afternoon, I need to know how to do it, using Mongoose, to filter a model from a foreign property. For example: const Usuario = new Schema ({ nome: { type: String, required: true }, cargo: {…
-
0
votes1
answer43
viewsDoubt about CONCAT SQL
I understand how it works about CONCAT of SQL-Server, but someone can help me? For example: I have 3 tables: Team, Engine and Pilot. used Concat with two tables Team and Motor Select Concat(Equipe,'…
-
0
votes1
answer35
viewsSum a column by Mysql ranges
Personal I have a table in my Mysql database like this: Table name is tb_cargaHora I’m trying something like this: SELECT nome, matricula, SUM(carga_hora) FROM tb_cargaHora Order BY nome; but only…
-
0
votes0
answers29
viewsI wanted to know the difference between the presence and absence of the first condition of the code below
I have a code that I picked up somewhere, some time ago, that I use to make connections with my database and it always worked well. I tried, then, to remove a piece of code that I didn’t understand…
-
0
votes0
answers62
viewsList users contained in the Django group
I followed the explanations of a page to create a group and add users to the group. But now I want to list the users contained in the group and show in html html tried some variations but no return…
-
0
votes1
answer70
viewsUpdate using different record from the same table
I need to make a update update the field record of a table, using another record of the same table and same field. My table is as follows: select produto,valor_bruto,acrescimo,valor_liquido from…
-
0
votes1
answer33
viewsDoubt column concatenation
The code below returns a sum per classification. Something like this: Services = type 1 Materials = type 2 the expected result is that there is only one row, and that in this Row I have the value of…
-
0
votes0
answers8
viewsPaging oracle Apex without updating query
Hello I’m with a problem, my company has a screen where we have a classic report which contains people’s permissions for screens and system functions, but we have a problem, we have a query that…
-
0
votes0
answers32
viewsMYSQL - How to Filter the Output of a main Select that has as one of the fields the result of a subquery?
Good afternoon Srs, this is my first post here, but I’m always researching the posts and the doubts of the people. I have the following situation: I CAN get all results, but I cannot FILTER what I…
-
0
votes0
answers12
viewsHelp with Group By on an Inner Join Sql Server
Good morning Gentlemen. I have the following Sql Query below that links data from two tables, the table Tab_dados_producao and Tab_data_choice Code: SELECT…
-
0
votes0
answers23
viewsHow to sum the columns without multiplying the sums?
When I run this query it sums the columns several times in the same number of outputs in the table itemsaida. select p.idproduto codigo, p.descricaoproduto nome, sum(e.qtde) entrada, sum(s.qtde)…
-
-1
votes1
answer76
viewsQuery php shows no expected result
I have a problem with a query because I ask to show me all fields that a certain condition that in a column is written 'Lisbon', but the result is: Lisbon and port. Query: Select * From…
-
-1
votes1
answer392
views -
-1
votes1
answer1266
viewsHow to convert sysdate to milliseconds in Oracle?
How to convert sysdate for milisegundos directly on Oracle? I need to give the same result as the code below in java, but directly in query: String s=df.format(Calendar.getInstance());…
-
-1
votes1
answer110
viewsQuery to join specific tables
I need to put together three different tables. But the result I want is: When there is the reference it must join, when there must be no blank or NULL. My structure: Table contact…
-
-1
votes2
answers79
viewsWhen giving the result of a query, this inserting only the first line
I am bringing a query from one bank and I will insert in another,this running the question and that is only inserting the first line and not all the results,see my script below: <?php…
-
-1
votes1
answer519
viewsHow to count the number of records (Rows) in an SQL statement?
I am in this SQL, recovering the records (number of vendors per city) of a table and I would like to count how many records have in each city. I want to put something like Tal City (9). I will put a…
-
-1
votes1
answer123
viewsHow to give Count up to a limited value, "countar up to 90 on a table that has 100"
I assembled the following Query - "INFORMIX" SELECT COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90); Which returns me the following error: An error occurred when executing the SQL command:…
-
-1
votes2
answers62
viewsPHP syntax error when inserting an image
I’m inserting an image into the database with the following code $nome_img = $_FILES['imagem']['name']; if(move_uploaded_file($_FILES['imagem']['tmp_name'], "images/Produtos/".$nome_img){ $query=…
-
-1
votes2
answers272
viewsSql auction script
I need to make an application for an auction company of used things, then I will need to create an interface where n customers can give a minimum bid and a maximum bid for a product X and the system…
-
-1
votes1
answer34
viewsSearch inside another Rails scaffold
I have a problem, an example created two scaffold book and loan, then created a controller and an index called report : rails generate controller RelatoriosEmprestimos index I want to do specific…
-
-1
votes1
answer169
viewsTake data related to more than one table separately?
There’s no way I’m doing this. It seems to be with Join, but when I try, returns me zero records. I have the tables: TB1, TB2, TB3, TB4, TB...etc All with PK (ID) I tried that code: SELECT ID FROM…
-
-1
votes1
answer24
viewsQuery error using 1 Where and 2 joins in search query
Hello, I’m running the following query in mysql: select * from usuarios where login='gamboamurilo' or email='[email protected]' and senha='8b0a60f71e758c8b27e7688ee754cd85' inner join…
-
-1
votes2
answers53
viewsDoubt SELECT Mysql
In a certain select I can reference two tables by foreign keys. Ex:Ida/ Idb Ida = Idb Table A has a column called C Table B has three columns called D, E, F Both tables have similar contents to…
-
-1
votes1
answer40
viewsDoubt Bring Specific Date - Oracle
In the query below is bringing this way. Data Inicial Data Final Dia da Semana 16/10/18 30/10/2018 3 Where that initial and final date is a specific period and the day of the week in that case is 3…
-
-1
votes1
answer85
viewsSubconsulta SQL
I’m doing the consultation below: select idtce from tab_tce where idempresa = 2493 and YEAR(dt_inicial) = 2018 and idtce not in( select TCE_ID from SEC_VAGA_ESTUDANTE ) But returns this error: Msg…
-
-1
votes2
answers117
viewsHow to get lower value without aggregation function - SQL
Assuming a Student table that has as attributes(Id, Name, age). How I get the name of the underage student but without using aggregation function(MIN)?
-
-1
votes2
answers26
viewsGROUP BY grouping data from another column into another column
all right? I need a help, I will explain below what I am doing and what I need: I am developing for a digital advertising agency an automatic e-mail system that contains all the campaigns and…
-
-1
votes1
answer134
viewsCheck if I have data in the query, when giving the next or prior
I have a query in Delphi, where I give the command next and prior, only I can’t check if it’s my first or last record, what I want specifically is, when pressing the next button, check if it’s my…
-
-1
votes1
answer280
viewsReturn data from two identical tables [SQL] [Python]
Hi, I want a help with SQL query. There are two identical tables but with different recorded data in each one. How can I get the data from both tables? As if they were two selects in each table?…
-
-1
votes1
answer40
viewsQuery Optimization - Mysql
Greetings to you, gentlemen! I come once again to seek the guidance of the masters of DB! As the last time I have a query that returns a very specific result and that works,a but is slow and as the…
-
-1
votes2
answers1495
viewsSQL Server Function - Holidays
Good afternoon! Dear friends, I have the following function below that is the days not worked that are coming only Saturday and Sunday, however, I wanted to include in this function the holidays.…
-
-1
votes1
answer143
viewsTake the lowest values of a Count using group by
Cheers guys, I have the following problem... The query below is almost perfect, but it is generating repeated Ids, what I need is the lowest Count value of each ID. The ideal result would be: ID |…
-
-1
votes1
answer379
viewsCannot access field on a value with type ARRAY
I’m trying to pull the spine name.pt_BR that is inside the column namebut I still don’t understand how to get it specifically in Bigquery. How to pull this info to give JOIN in another query later?…
-
-1
votes1
answer59
viewsWhich country had the largest total population each year
I created this table: CREATE TABLE `Populacao` ( `ano` int(11) NOT NULL, `pais` varchar(2) NOT NULL, `popM` varchar(10) DEFAULT NULL, `popF` varchar(10) DEFAULT NULL, ); Where popM is the male…
-
-1
votes1
answer40
viewsSQL queries with multiple tables
I am studying SQL and needed to make a query, which for me is more complex. I have the following tables: Tabela Ativo: id, tipo_ativo Tabela Carteira: id, nome.. Tabela Movimento: id, ativo_id,…
-
-1
votes1
answer23
viewsHow to search records until the previous month?
I need to get all the data, from the beginning to the previous month, this query has to be dynamic, I can not put a fixed date, because next month we need to consult again... In summary, today I…
-
-1
votes3
answers1256
viewsHow to do an INNER JOIN bringing everything from two tables and one more "max" in a specific field?
Good guys, to be more specific I have two tables,. table 01: ...and table 02: ...and would like to make a "select" bringing all of these two tables, but where in the field "points" (table 02) have…
-
-1
votes2
answers376
viewsQuery does not return fetch_array
I’m trying to make a query however, although the query works well in Phpmyadmin in the browser returns the message below: Fatal error : Call to Undefined method Pdostatement::fetch_array() in D:…
-
-1
votes1
answer79
viewsLinq to Entities - Count elements of a query referencing two contexts
I have the following query: var query = (from q1 in query1 join q2 in query1 on q1.idGenerico equals q2.idGenerico into q2Left from q2 in q2Left.DefaultIfEmpty() join q3 in query3 on q2.idGenerico…
-
-1
votes1
answer1269
viewsHow to return the id of the user in the session
require_once('conexao.php'); @$email = $_POST['email']; @$senha = md5($_POST['senha']); // $email = "[email protected]"; // $senha = "12346"; $pdo = $dbconn->prepare("SELECT userid, nome,…
-
-1
votes1
answer41
viewsHow to return an sql answer?
This is my first forum post, so I apologize if I make a mistake. The thing is, I need to register a book in the bank, but before that, I need to know if the author is already registered in the bank,…
-
-1
votes1
answer389
viewsHow to make an INNER JOIN in a single table with 3 keys?
I have a table that has the following structure: origem|papel|campo018|campo040|mercado|Master_key| The column Master_key can have two values: 'NY' OR 'MS', I would like to compare the lines where…
-
-1
votes2
answers572
viewsHow do I do a NAME search filter in PHP ?
I have tried several ways, but all of the problem in the query... Exemplo : <form class="form-inline my-2 my-lg-0" method="post" action="home.php"> <input class="form-control mr-sm-2"…
-
-1
votes1
answer81
viewsDoes my SQL Query not work properly?
I have a system that uses dates for registration and I separate the date by a explode formed by arrays and record them in a database, but when I do the query that searches them by order, the order…
-
-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…