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
-
1
votes1
answer279
viewsSearch query coming from a Dynamic form (Codeigniter)
I have a problem to build a QUERY that comes from a dynamic form. I have a search form in which the fields for search are dynamic (can be text or checkbox), or whenever a new field is added it must…
-
1
votes2
answers229
viewsMysql Query - Count separate table fields
I need to create a view in Mysql where return the following result. Col1 | Col2 Total Tab1 | Total Tab2 I am using UNION in the form below, but the result comes as follows: col1 201 5699 CREATE VIEW…
-
1
votes2
answers236
viewsError bringing Time and Date
I am registering in the Mysql database values such as time and date. Code JAVA: public String getDataPedido() { StringBuilder horaSistema = new StringBuilder(); GregorianCalendar pegarHora = new…
-
1
votes1
answer28
viewsReturn tags associated with posts
I use the query below to return all posts marked with the tag set: SELECT imprensa_posts.slug AS slug, tipo, titulo, data FROM imprensa_posts JOIN imprensa_tags_posts ON imprensa_tags_posts.id_post…
-
1
votes1
answer2049
viewsHow to do INSERT in three tables with Stored Procedure?
I need to perform a Insert in three related tables in the same query. I have the following scenario: Cidade, Estado e Pais How can I build a stored Procedure in Sql Server for this?…
-
1
votes1
answer45
viewsSQL to know the last edited record
I have the following SQL: $dcadastroultimo = date("d.m.y"); $sqlidcidade = "select id, titulo, tipo from imoveis where cod = '$cliente' AND ueditado <= '$dcadastroultimo' ORDER BY id ASC"; I need…
-
1
votes2
answers1520
viewsHow to pass a server parameter to the client in Datasnap?
How can I send and receive data using datasnap? I have a Mysql database, a Mobile application in Delphi Seattle with a datasnap server, the connection works and I can take the data from the bank and…
-
1
votes3
answers328
viewsSQL - Query in a single table with null values
Hello, I need to make a date-filtered query. The problem is that non-existent dates in the table need to be returned by the query, having all other fields as Null. SELECT Data, Servico FROM…
-
1
votes1
answer46
viewsExport from SQL to Excel and perform Download Syntax error: Unexpected ',', expecting end-of-input
I made this Query MtDispositivo.where("id_conta = 28 or id_conta = 29 or id_conta = 30 or id_conta = 36") This Query returns me all accounts containing the Ids: 28, 29, 30 and 36. Could you give me…
-
1
votes1
answer166
viewsPHP How to pick a random value like Rand($min, $max) but with a query?
For example, in a browser game I want when the user clicks attack to return another user who has +- the same battle power as him. $select = $mysqli->query("select * from data order by rand()");…
-
1
votes0
answers57
viewsNumber of queries to check user in the Standard
I have a system of user authentication, where do I use the API sentinel in the Laravel 5.2. When I do the Check_user() in the middleware to see if the user is logged in and has access to the route,…
-
1
votes2
answers1896
viewsHow to make a record count for each day between a date and another?
I need to make a query, to return the number of records registered in EVERY DAY, between two dates. I’m using a mysql database, and I tried here, but no way seemed right.
-
1
votes0
answers110
viewsMultiple queries with a single connection
I’m making a site where on the same page I need to make several queries, in mysqli. when I run the site in xampp runs perfect. but not on the web server. Only comes the first consultation and not…
-
1
votes1
answer342
viewsI can’t bring all the records from the table
Hello, I’m not able to show all the records of a row of the BD table, I can only bring the first record. Here is my table: CREATE TABLE IF NOT EXISTS `tbnoticiasrel` ( `id` bigint(20) NOT NULL…
-
1
votes0
answers108
viewsProblem with aggregation function, using Hibernate Createquery
In a Package, a fkEmbaling refers to the 'father', the larger package. EX: Let’s say that 10 A packs fit inside a B package. A packaging record A will have in its fkEmballing the packaging B in…
-
1
votes2
answers309
viewsSQL update query syntax error
When I run the following update query there is a syntax error before or inside from: UPDATE Artigos SET totale = entradas.sent FROM Artigos INNER JOIN (SELECT cod_artigo, Sum([quantidade_ent]) AS…
-
1
votes1
answer73
viewsQuery to return only the records of the last 24h (Codeigniter)
Hello I needed to do a query that returns the values of only the last 24h i have the following query: $date = date("Y-m-d H:i:s"); $this->db->select('*'); $this->db->from('inscricoes');…
-
1
votes1
answer91
viewsJPQL Query for Data Insertion
How can I enter a data with JPQL containing values: @Query("insert into user values()") User insertUser(); Dice: nomeUsuario emailUsuario…
-
1
votes1
answer54
viewsInclude with parameters
How do I include another php file passing information with it, for example I aim to include a php that has a message system that creates a temporary html that error: For example I want to give…
-
1
votes2
answers235
viewsLimit 1 line in queries with primary key queries
One of the best practices on optimization of Mysql queries, dictated in an internet source, says that it is important to limit as 1 the queries that already display only one line. For example, if…
-
1
votes0
answers56
viewsTurning this code into PDO
wanted to turn this query into PDO,? include 'config.php'; extract($_POST); $user_ip = $_SERVER['REMOTE_ADDR']; // check if the user has already clicked on the unlike (rate = 2) or the like (rate =…
-
1
votes1
answer3043
viewsmysql error code 1111. invalid use of group Function
I tried using the following query in my database: SELECT MAX(COUNT(DISTINCT c.unique_carrier)) FROM companhia_aerea c, avioes4 a, ponte2 v WHERE c.unique_carrier = a.UniqueCarrier AND a.TailNumber =…
-
1
votes3
answers1386
viewsUncaught Exception Pdoexception error with message 'SQLSTATE[HY000]: General error: 2014
I have a code that works perfectly on the local wampserver server, it is a query interspersing the result the problem is that when finishing the site and hosting it I get an error. The code is this:…
-
1
votes1
answer195
viewsSelect two attributes from two different tables in a view
I have the model (superclass) Pessoa and the model Aluno public partial class Pessoa { public Pessoa() { this.Escola = new HashSet<Escola>(); } [Key] public int PessoaID { get; set; } public…
-
1
votes1
answer20
viewsPreview input field does not work
my browser is not displaying the image. Fear something wrong with this code? $(document).ready(function () { $("input[name='fun_imagem']").change(function () { readImage($(this)); }); }); function…
-
1
votes1
answer51
viewsHow to update a field using it at the same time?
I wonder if there’s a way to add the value of a line to itself without having to do a query then an update. I have a column called total that stores integers, at a given time I want the value that…
-
1
votes1
answer1546
viewsSQL query grouping by age group
Hello, I need a way to make an sql query that brings me the amount of male and female people. OBS: I have two tables where the first one is registered in it I have the sex column and another table…
-
1
votes1
answer782
viewsOrder by SQL Server under Procedure
Hello, I have the following situation: I need to select the amount of care of people of some age groups and of those who are male and female. I have the following tables: cadastro (id, natendimento,…
-
1
votes3
answers76
viewsError using HAVING in date/time query
I have the following appointment: SELECT ROW_NUMBER() OVER(ORDER BY V.DATA ASC) AS ID, V.CHAPA AS CHAPA, F.NOME AS NOME, V.DATA AS DATA, CASE WHEN V.BATIDA IS NULL THEN 0 ELSE V.BATIDA END AS…
-
1
votes1
answer266
viewsQuery to multiple tables in mysql
My model is the following, I have 4 tables Avião (tailnum (PK), year) Voos (id_voo (PK), cancelled) Modelo (idmodel (PK), nome) Fabricante (id_fabricante (PK), nome) Airplane is with a 1:M…
-
1
votes2
answers268
viewsHow to mount an SQL to display grouped content per month?
I need to mount an SQL to group information per month within Bootstrap formatted columns. Come on: <div class="container"> <div class="row"> <div class="col-md-3"> <h2…
-
1
votes1
answer312
views -
1
votes3
answers227
viewsHyphenate when value is 0 in select
How can I do in the mysql one query (SELECT) so that when the value is equal to 0, replace it with hífen(-). Field of value: int.
-
1
votes1
answer58
viewsHow do I recover filters from a query?
Hello. You can find out which filters, sorters, etc were used in a query? Example: public class Program { class Produto { public int Id; public string Nome; public Produto(int id, string nome) {…
-
1
votes2
answers210
viewsGet older value from another table
need to create a query that returns the oldest stock of each product within a specified period: Tabela Produtos: ID DESCRICAO 1 TOMATE 2 ABACAXI Tabela Estoque: DATA HORA PRODUTO ESTOQUE 01/01/2015…
-
1
votes1
answer1595
viewsGeneral error: 1449 when fetching Mysql Database records
I am getting the error below while doing SELECT: SELECT * FROM vn_horario_view; SQLSTATE[HY000]: General error: 1449 The user specified as a Finer ('root'@'localhost') does not exist How to resolve…
-
1
votes1
answer88
viewsIs there a way to join 2 queries of different tables in a single query?
I wonder if there is a way to join 2 queries of different tables in a single query? For example, in the code below I have 2 queries in separate tables. However, there is a way to perform these 2…
-
1
votes0
answers286
viewsUnidac uniQuery component does not return keygenerator value
I’m having trouble inserting into Firebird using Devart’s uniQuery (Delphi 7 with Unidac) component. The primary key field is in the query fieds and the component configuration is like this:…
-
1
votes0
answers300
viewsTruncate numbers in a Mysql column
I want to leave all numbers that are entered in my bank with a maximum of 1 decimal place after the comma without rounding Ex: 3.2567 = 3.2 I want to know if I can truncate all the column of the…
-
1
votes1
answer664
viewsQuery to return recurrence values, which have not yet been created in the database
I need to make a query in the database where the records are not yet saved. I will explain better: In a system that I am developing, the user can register a recurring expense, that is, it will be…
-
1
votes2
answers371
viewsDifficulty Mounting SQL Query with UNION with SUM
I have 2 tables that stores type of different sales, and I need to add everything to get the amount to generate the charge, however I am not able to mount the sql query, follows: SELECT…
-
1
votes3
answers260
viewsProblem in PHP+Mysql query using LIKE
Good afternoon guys, recently in one of my projects a problem arose and I hope you can help me. To better understand the site is a site of consultations in the area of health, as clinics,…
-
1
votes1
answer2484
viewsMongodb query and return array specific elements within objects
Guys, I need a help to query certain values in a document. I have a collection in Mongo that follows this structure, including this is the document I can and need to locate:…
-
1
votes2
answers151
viewsCount function - Mysql
I have the following tables: times - time_id INT - time_nome VARCHAR rodadas - rod_id INT - rod_rodada INT - rod_pontos DECIMAL (10,2) - rod_fk_time INT I need to add the score and group by team.…
-
1
votes0
answers73
viewsHow to show decimal places only when they exist?
How could I make in my select the numbers appear without decimal place when they are 00 and appear decimal places when they are non-zero. Example: I have 5 numbers returning like this: 16.00 ; 10.00…
-
1
votes1
answer153
viewscreateQuery(HQL) returns Nullpointerexception when trying to perform LEFT OUTER JOIN
Personal talk, I have a problem trying to run an HQL on my application. The HQL is basically this: select c.id, c.solicitante from <mypackage>.Exame c LEFT OUTER JOIN…
-
1
votes2
answers6147
viewsConcatenate columns into a single Postgresql row
I have a situation that would make it much easier. if I could return the data from a specific column in a single row: For example: Table A: Codigo | Descricao ------------------- 1 | Descricao 1 2 |…
-
1
votes1
answer36
viewsDoubt Query Mysql
I have a little doubt and difficulty in trying to solve my problem, I have the following query: SELECT `PcldCliente`.`id`, `PcldCliente`.`nome`, `PcldCliente`.`agencia_id`, `PcldMain`.`id`,…
-
1
votes3
answers76
viewsHow to do sub-consultation with Pdo
I would like to perform a sub-query within that query: $ranking = $pdo->query("SELECT * FROM usuarios_emblemas GROUP BY usuario ORDER BY count(usuario) DESC LIMIT 3"); It would be to block the…
-
1
votes1
answer50
views