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
answer66
viewsLinq does not return data. There is data in the table and I return by query
I tried to make a LINQ very similar to my query. This is my query. select * from PDV where tipo_PDV = 'R' and UF = 'DF' and Cidade = 'BRASILIA-DF' This is my LINQ var resultado_rede_descricao =…
-
0
votes1
answer254
viewsHow to do a random search using JPQL script in JPA2
The idea is basically to search for an X number of entities persisted randomly, and these entities cannot be repeated. The question is, is there any way to perform this type of search by creating…
-
0
votes3
answers1664
viewsHow to Display SQL Query in an Array
I have a question. When I run a Select Count in the database it displays everything straight. But how to display it the same way using PHP? select country, count(*) as quantidade from customer group…
-
0
votes1
answer790
viewsinserting image in mysql database
If I want to insert an image in the database just use the following query: INSERT INTO teste (Id_Blob,Na_Imagem) VALUES (1,LOAD_FILE("C://imagem.png")); if I want to insert an image that be on…
-
0
votes0
answers128
views -
0
votes3
answers1148
viewsTake a variable value from Sql Server
I have this Sql block: SET NOCOUNT ON; Declare @QueryString as NVarchar(4000), @Datazero as varchar(20), @Datamn as varchar(20), @CdUsuario as integer, @SitProcesso as int ,@DsUsuarioRede…
-
0
votes1
answer31
viewsError in mysql query
I am hours away from realizing what is wrong with my query. I would like you to give me a help SELECT `recargas`.`valor_recarga` as saldo FROM `contas_pessoais` INNER JOIN `contas` ON…
-
0
votes1
answer850
viewsRun a query by clicking on the result of another query
I have the following column structure from my database: account_id, name and appearance. Imagery: http://puu.sh/gYLVL/4083073484.png I had the following code previously: <font size="3">Por…
-
0
votes1
answer108
viewsUsing python and Django, querys problem
I’m using Python with the Django framework. This method must return a resulting query, to send e-mail to the corresponding emails from the database. However, the method works for some cases and for…
-
0
votes1
answer271
viewsQuery sorting - sql server
I need to sort my query so that the column "Centername" is in accordance with the logic applied in the column "All levels" someone could help me please? WITH CentroNiveis AS ( SELECT cen.Id,…
-
0
votes1
answer773
viewsShow only positive delay days in SQL query?
I am making a query where I intend to calculate the amount of days of delay in a salary, I would like to show only if there are days of delay, at the moment I am showing days remaining for the…
-
0
votes1
answer335
viewsList by Mysql and Java foreign key
I’m trying to select the dvds that the partner registered but I’m not getting, I wonder if someone can help me, the result of my code returns like this Result: 1 - null - null - null - null - null -…
-
0
votes1
answer56
viewsSQL Query according to the Make a New Column
I have a column that is numerical. In this column there are positive and negative values. I need to make an appointment that when I’m positive, I’ll consult Tabela A, when negative I refer to Tabela…
-
0
votes1
answer86
viewsError copying data from one table to another
Good afternoon Guys, I’m making an application that makes a Dvs loan request, I managed to make the application to enter the reservation, now I need to make the dvd owner confirm the rental and copy…
-
0
votes1
answer473
viewsConcatenate in the PDO query
I’ve heard that when concatenating into a query using PDO can cause slowdowns and even leave the system vulnerable, this is true? I want to concatenate into one query and I’m afraid to take certain…
-
0
votes1
answer36
viewsQuery with two tables
I’m on a project, I have client table and work. A job has a client. I’ve already listed the tables, but I need to select that from the client id in the work table, return the client name. I have to…
-
0
votes2
answers54
viewsQuery that returns multiple results
I have this query MtDispositivo.where("id_conta = ?", "28") that returns to me all accounts that present the ID_CONTA = 28. Below I have these other Querys that return me same result that are…
queryasked 9 years, 4 months ago Robson Argolo 31 -
0
votes2
answers227
viewsSQL Query, Join 4 tables, 2 group_concats + conditional, Help
Hello, I created an sql query to return all the client data in a single query, this query works partially if all conditions are satisfied, but this system uses soft delete, where all records cannot…
-
0
votes1
answer80
viewsQuery in SQL Server
When doing the sequinte query select * FROM conta It brings me the columns, being that the id_fornecedor comes from the table fornecedor id | id_fornecedor | conta_status 1 | 1 | S I would like to…
-
0
votes1
answer45
viewsMs access 2 querys for the same comboboxes
Good to all I am programming a database and I would like to have a kind of 3 querys. I’ll try to be as precise as I can. I have 2 combination boxes that are interconnected, in this specific case…
-
0
votes1
answer406
viewsQuery with the following logic
Hello friends of the community. I need to fill a chart but I can’t assemble the query to receive the attributes, could someone help me? The query I need to do is the following. select client.name,…
-
0
votes1
answer166
viewsLaravel 5 - database table for array with predefined index
Is there any way to retrieve the results of a query in the database and transfer it to a Array with one of the table fields being index of Array? You could achieve this result in two steps. After…
-
0
votes1
answer112
viewsquery optimization that adds values according to a clause
Hi. I have a query that I must bring two columns, and one of the columns will return the value of a column, plus the sum of another column respecting the Where clause to add the values. I came to…
-
0
votes1
answer118
viewsQuery with two summations for the same column
It is possible to make a query in which in the same query two sums are executed on the same column? Here’s what I got: Total sum of sales select month(emitido_date) as mes, ifnull(sum((det.preco *…
-
0
votes1
answer194
viewsHow to do a search in an app using Angularjs with correct parameter passage?
How to do a search in an app using Angularjs with parameter passage correctly, when I speak correctly I refer to avoid SQL injection. For example, the parameter var parameters = "joao"; in the query…
-
0
votes0
answers23
viewsRegistration with empty column affects performance at query time
Let’s say I have a table with 4 columns and 4 records. Not all columns are filled in at the time of the form because it is not mandatory, so the database has some gaps in its grid! Example: ID |…
-
0
votes2
answers124
viewsHow to know if a record has been made in the database?
How do I check if a certain id has been registered in the database, and if you have not registered using an Insert query and if you are already registered using an update query ?
-
0
votes0
answers113
viewsPerform subtraction using aggregation functions
I have a table immovable with the fields of code, price and area. I need to find out what is the price difference between the largest and the smallest property in the table (in a matter of area). I…
-
0
votes0
answers37
viewsassign rows in a column to different variables
Good afternoon, I’m beginner in php and wanted help with a code. I made a query that selects a column and limits 6 lines in descending order, the query worked all right, but I’m having difficulty to…
-
0
votes1
answer919
viewsSELECT with REGEXP
next, I have a table of people: [name, license plate, Cpf] What happens is, some people who have the "same" Cpf have different enrollments. [Same] is in quotes, because in the database, there are…
-
0
votes2
answers6610
viewsSelect within select sorted by the second mysql query
I got a problem, I don’t know if I’m doing it right, but come on. I have a table that lists some employees ( tblTecnicos ). I have another table , which has the records of services that these…
-
0
votes2
answers165
viewsHow to consult a table in a limited (partial) way?
I need to consult a table extracting from it the Infos: <nome> and <pontuacao>, my tcc consists of a game in which one of its options is to see a ranking of registered players. as there…
-
0
votes1
answer4203
viewsHow do I do this query with subselect in the Laravel?
I tried anyway, but he won’t ride for me SubSelect. I used the method toSql() to confirm and really he does not ride. SQL SELECT p.descr,p.dt_hr, (SELECT u1.name FROM users u1 WHERE u1.id =…
-
0
votes1
answer81
viewsAdvanced SQL query with dates
I have been in trouble for days. I have my chart and need to count how many grades are late, so that’s okay. I just don’t know how to make that appointment. I need to check if they are late, to be…
-
0
votes1
answer76
viewsRemove duplicate records from a table
Having the following tables without keys still defined: Aeroplane (code_aviao, code_company, year, type_engine, type_airplane, status) Flight ( Flight code, Flight number, plane code, code_company)…
-
0
votes1
answer759
viewsSql Query, fetch data from given ID
how to make a query, searching data from the given ID? For example, my table has 1 thousand records, I want to determine in a foreach the search of the data from the record 300.
-
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
answer112
viewsDynamic Select with query
I want to make a dynamic form like this: https://www.w3.org/WAI/WCAG20/Techniques/working-examples/SCR19/dynselect.html I am having difficulties in connecting mysql, php and javascript to the…
-
0
votes1
answer599
viewsQuery Performance - Postgresql
I have the following situation, I need to bring data from a vehicle table of the system in which I work and another with integrated data of a partner system, for being integration the data are not…
-
0
votes0
answers51
viewsParse relational query in a single Httpget call
good morning. This question is for the Android environment. I use ADT. I need to implement in Parse a Car table and a Manufacturer table. Car has the model and manufacturer fields. The Manufacturer…
-
0
votes0
answers35
viewsMultiple querys with php
hello everyone would like to know how to run two querys at the same time in php the situation and the following intend to do an Insert and return the auto_increment key I am doing the following…
-
0
votes0
answers70
viewsErroneous paging count in wordpress
When the Slug stored in var $type is for example 'pizzas-salgadas' the pagination rolls normally, now when this Slug changes, the pagination appears even without the need to appear, with several…
-
0
votes1
answer669
viewsoccurrence of word in sql query
I have an appointment SELECT NOME FROM PESSOA WHERE CODIGO = 1 She returns to me ANA ANA JOAO ANA ALBERTO ANA There is a way to count the events of ana? Using only the sql query?…
-
0
votes1
answer605
viewsSum mysql decimal values
I made a query that adds a decimal field, only I’m having trouble, because when I put the clause group by t1.id_sell it lists me sales but no longer sums correctly and without the correct sum clause…
-
0
votes3
answers645
viewsSQL Server subquery is always returning null. How to fix.
I have a Procedure and a COMMON TABLE EXPRESSION(subquery). This my CTE does a search and offers to my query the result, my query then uses the results of it. In my table Address I have a field…
-
0
votes1
answer58
viewsGroup function does not work
I have two tables. Table: Pedido Columns: IDPEDIDO, CLIENTE, DT_PEDIDO, FORMA_PGMT, CLIENTE_ID. Table: Itens_Pedido Columns: PEDIDO_ID, QT_MERCADORIAS, MERCADORIA, MERCADORIA_ID. I need to create a…
-
0
votes1
answer93
viewsSelect conditional that takes value from another table
I need to make a conditional select that checks a sum performed that way: select round(sum((`gin`.`Caixa_9L` / 1000)),1) AS `total` from `gin` If this sum above is = 0, I need to take a value of a…
-
0
votes2
answers79
viewsComplex wp_query
I am setting up a schedule of events in Wordpress and need to list all the events of the week grouped by current day. I have events that last only one day and others that last all month. I created…
-
0
votes0
answers45
viewsFetch columns from two tables that are not directly related
I have 5 tables: cliente, produto, compra, compra_produto and fornecedor. And the following relationships: compra (fk_cliente) compra_produto (fk_compra) compra_produto (fk_produto) produto…
-
0
votes0
answers222
viewsPage-blog.php pagination in Wordpress
I’m creating a theme Wordpress and created a page called Blog that is using the file page-blog.php as a model and the Slug of the page is also blog, where the same will list all the posts of a CPT…