Most voted "mysql" questions
Mysql is a relational database management system (RDBMS) that functions as a server, and provides access to multiple users simultaneously. Your source code is available under the GNU General Public License.
Learn more…10,264 questions
Sort by count of
-
2
votes2
answers116
viewsORDER BY orders by the first house and not by the number itself
I’m pulling values with order by and they’re not right in either ASC or DESC. My code is this, how can I fix this mistake? $sql = 'SELECT *, Player.ID AS ID, LEFT(FirstName,1) AS FirstName,…
-
2
votes2
answers211
viewshow can I get the last message from my`msg`field with`GROUP BY`
good evening, I wonder how can I bring the last message from my group by, because I’m not getting it. is always bringing the first occurrence of the consultation and I always need to take the last…
-
2
votes2
answers85
viewsInclusion of data by the operator
I built the code below but when I insert the data the system shows error. package tarefaBD; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import…
-
2
votes2
answers84
viewsMysql Select replace a code with information
I have two situations in the search inside Mysql that I need to exchange the code for a literal data. Field: Pgto (possible data: S or N) In the search if the Pgto field is N I display on the screen…
mysqlasked 5 years, 1 month ago Brenno Sacramento 47 -
2
votes2
answers113
viewsMysql select data by period
I’m trying to select data that starts on one date and ends on another, I’m doing it this way: SELECT * FROM vendas WHERE feita_em >= '2019-10-10' AND feita_em <= '2019-10-11' And this is the…
-
2
votes2
answers239
viewsConsume JSON data from Mysql PHP flock
I created in my MYSQL 3 fields ID, Cliente, Produtos where they are registered via JSON the information of Cliente and the produtos that he selected. JSON Client { "nomecliente":"Cristiano",…
-
2
votes1
answer70
viewsReturn an in_array() true within an SQL result
I have a function within the class UsuarioVisitas: // Retorna o array com os mais visitados public function CS_GetMaisVisitados($sql_aux) { global $objConexao; $strSql = "SELECT cod_usuario,…
-
2
votes2
answers45
viewsError in SQL output
Guys, here’s the thing, I’m having to do a select in a bank, where I should look for values that exist between two dates, and that have a specific user. I made the select so: SELECT * FROM `tabela`…
-
2
votes1
answer814
viewsError opening Mysql connection via ADODB
I’m trying to connect an application made in VB, Visual Studio 2017, using ADODB as a connection, but it is with several errors for different connection options. Already anticipating me, I checked…
-
2
votes1
answer192
viewsGroup by age range
I would like to tabulate customers registered in a database mysql by age range. I have a field nascimento guy date. With the consultation below I can group by birth. SELECT COUNT(*) AS qtd,…
mysqlasked 4 years, 11 months ago Pedro Augusto 2,392 -
2
votes3
answers1589
viewsHow to redirect user after login according to user type?
in the system there are 2 types of users 1 = admin and 2 = teacher, and after logging in need redirect each to a different page. This is my php and html code. require "lib/authenticate.php"; $error…
-
2
votes1
answer36
viewsmysql subquerie
Guys I’m with the following structure: CREATE TABLE Cliente ( Id_cliente int NOT NULL, Nome_cliente CHAR(30) NOT NULL, Endereco CHAR(40), Telefone char(12), PRIMARY KEY (Id_cliente) ) Engine=InnoDB;…
-
2
votes0
answers348
viewsChanging Mysql with ajax and PHP
I created a system that the user can view data from a mysql database and eventually interact with that data (by changing through a select the column status in the database). There is currently a php…
-
2
votes1
answer759
viewsHow to add a value to the current in each row of a mysql table?
I have the following table in a mysql database: I would like a command to run in phpmyadmin, which sums the current value of the rating_sum column with 5, and rating_count with 1, thus leaving: I…
-
2
votes1
answer899
viewsCreating event in Mysql
I would like to create an event based on 2 situations. I have a table and a column situat_id with values [1 - free], [2 - busy], [3 - Unavailable]; And another modified column - generates the…
-
2
votes1
answer1338
viewsCalculate Mysql percentage
I’m looking for a percentage calculation. Taking the value that was received in that selected month (received = 1), divide by the total value of that selected month, and multiply by 100 to return…
-
2
votes1
answer39
viewsOptimizing columns of Mysql tables that receive only two different values
I have a Mysql table with 30 columns, and 25 can receive only one of the following values: Not or Yes. Currently they are defined as char(3). In case I convert these char columns to tinyint,…
-
2
votes2
answers1344
viewsLocate record in Mysql by specific character
I have a bank called completo, whose table dados is: id cpf nome 1 38831370570 joao da silva 2 27283620508 maria joaquina 3 94470661945 carlos eduardo I would like to 'Filter' all Cpfs q contain a…
mysqlasked 7 years, 5 months ago Ismael Alfredo 23 -
2
votes0
answers54
viewsmysql if - how to apply to equal records
Hello! staff I am trying to select and apply a rule only in equal records. I need all records to be listed, but in those that are equal, a specific rule is applied; For example, select all client…
-
2
votes1
answer37
viewsNullpointerexception when trying to log into the system inside netbeans
Soon after I did some icon overwrites on the main screen and on the About screen, error occurred NullPointerException, I have no idea how to continue and continue the course I am doing. I use Mysql,…
-
2
votes1
answer355
viewsGet all data with the same id without knowing the id
I have a table in the database with information that have the same ID, as if they were a set, I would like to get all the information with this ID, but I don’t have it, and I’m using a LIKE to…
-
2
votes2
answers2375
viewsSum the total value of two columns, subtract, and return even if negative Mysql
I have this following query: SELECT FORMAT(SUM(receitas_dia) - SUM(despesas_dia),2,'de_DE') AS saldo_efetivo FROM (SELECT SUM(r.valor_receita) AS receitas_dia, (SELECT SUM(d.valor_despesa) FROM…
mysqlasked 7 years, 5 months ago Eduardo Henrique 124 -
2
votes2
answers146
viewsHow to give an UPDATE by swapping for ?
I am trying to perform an UPDATE to change the \\ for \ , as in SQL below: UPDATE `post` SET `descricao`= replace(descricao, '\\','\'); I was told that Mysql does not accept regular expression on…
-
2
votes3
answers69
viewsBreak query result in 2 lines
Good afternoon! I have the following question My query is returning a single line, but I would need it to return two lines, where the first line would be the return of "B" and the other the return…
-
2
votes0
answers258
viewsRequest on the same page with Xmlhttprequest
Good morning, I’m using a script with 3 files. ->index.php (where the request is made) ->contacto.php (is the search and processing of the request) ->ajax.js (which reads and loads the.php…
-
2
votes1
answer57
viewsMysql Connector/C error
I’m having a C problem, while trying to include Mysql bookstore gave some strange errors that I didn’t find anywhere. I downloaded the bookstore on official website for Win32-x86 (ZIP) and installed…
-
2
votes5
answers626
viewsSelect between month and year only dates
Good evening, I believe my doubt is easy for some, but I am beginner is breaking my head, I need to do a search with select between the two dates, searching only the month and the year... I did with…
-
2
votes1
answer2359
viewsReturn of "?" instead of the special characters in a SELECT
I’ve got a problem, I’ve encoded everything with utf-8, I’ve tried multiple ways to fix it and I can’t, in one <option> of HTML, I pull a table from the database, but it returns with a special…
-
2
votes1
answer42
viewsI deleted old posts and the database was almost the same size
I have a database with news posted since 2015. I decided to delete the posts, leaving only the last 30 days. With this, I expected the database to reduce in size and this did not happen. Look how I…
-
2
votes0
answers2276
viewsWhat causes invalid JSON error?
I’ve done what was said in this post: json_encode - Invalid JSON and it hasn’t been resolved yet, so I’m asking. I’m using the jquery datatables server side. I made the activation server side with…
-
2
votes5
answers412
viewsSave or not the commands used in Mysql
When you create a Mysql code and run, that code after running, do you need to save it or not? Or after running can you forget it? I’m talking about the commands that create table, update, insert,…
-
2
votes3
answers313
viewsLogin problems using the crypt() function in PHP
I’m returning to the world of PHP after a long winter. I took an example of user registration that uses MD5 as encryption standard and now I’m struggling to log in a test user because I need to…
-
2
votes0
answers564
viewserror #1932 in phpMyAdmin
I installed XAMPP for Windows 5.6.15, Apache + Mariadb + PHP + Perl. Everything works fine until "out of the blue" some tables are randomly "in use". I just can’t access them anymore, keep…
-
2
votes3
answers64
viewsWhy using 'IN" to filter records along with a subselect returns records that have, in certain columns, equal values
I was studying and I came across this, I know IN is like the OR, but what I didn’t understand was this command: SELECT * FROM Customers WHERE Country IN (SELECT Country FROM Suppliers); The return…
-
2
votes1
answer998
viewsHow to show result via ajax and jquery without refresh happening on the page
I tried to implement an Ajax call in a project and I can’t identify the error. I have a form for posting status and I would like that as soon as I post something it does not refresh the page but…
-
2
votes2
answers1155
viewsMysql with Nodejs: insertion of records
I created a script called 'test.js" just to demonstrate a simple insertion of log records into a Mysql database, using Nodejs, as follows. Will be generated around 5 logs per second, which makes me…
-
2
votes2
answers20
viewsCreate COLUNM with results from an account made within a ROW - Mysql
Probably the title of this question is not correct, the case is that I would not know how to explain my doubt without an example. I have a scenario where I need to add up the values of products that…
mysqlasked 7 years, 4 months ago Maurício Sanches 487 -
2
votes1
answer41
viewsError updating AUTO INCREMENT
I have the following code: $sql='ALTER TABLE tributos_prod AUTO_INCREMENT=:ultimo_id'; try { $query_delete=$conecta->prepare($sql); $query_delete->bindValue('ultimo_id', $ultimo_idTP+1, PDO: :…
-
2
votes1
answer92
viewsAverage and count for each SQL product
I’m trying to update a table in my database into two new columns, one that brings the average of the ratings and one that brings the number of ratings. These data are obtained through two tables,…
-
2
votes4
answers1346
viewsSelect query by age group
I made an appointment select thus: SELECT data, sexo, idade, count(*) qtd FROM marcacao group by data, sexo, idade And return me a table similar to the table below: DATA | SEXO | IDADE | QTD…
-
2
votes0
answers329
viewscorrect sql query does not work in php
I have a query, where this query works perfectly in mysql Workbench, but in php does not work. $dados = explode("-",$ids); $sql = "SELECT prt_produto_item.nome as nome_item,…
-
2
votes3
answers881
viewsHow to redeem all data of the current month grouped by date?
I have the following table: +------------+--------------+-------------------+ | ID | vacina | data | +------------+--------------+-------------------+ | 1 | Cinomose |2017-07-10 10:11:15|…
-
2
votes3
answers52
viewsMultiple foreign keys in a single query
Well, I’m having some problems creating a query in mysql that searches several tables in a single query, I searched here in the stack, I found some similar questions, but I couldn’t understand the…
-
2
votes1
answer73
viewsRelate groups among Researchers with at least 2 common areas in MYSQL
I need to group all Researcher-type users (idUsuarioType = 3) who have 2 areas in common (idAreaAtuation) Example: Maria, Pedro, José and Roberto have the areas Environment and Ecology in common.…
-
2
votes0
answers192
viewsSlowness in generating reports
Well I’m having some bottlenecks in my application and I’m not identifying the problem. I will try to explain as much as possible what happens and the configuration I use. Server settings I use a…
-
2
votes1
answer23
viewsI want to group database data (Firebird) to send emails
Good, I am selecting the data for sending the email in this SELECT: SELECT V.id_venda_cab, V.id_cliente, V.Total, C.nome, i.id_produto, p.descricao, C.email FROM VENDA_CAB V INNER JOIN CLIENTE C ON…
-
2
votes2
answers142
viewsDocker: Problem using container IP
Hello, All right? Before long I learned to use Docker and decided to practice the use of mysql and adminer, with the following Docker-Compose I already had the containers standing. version: '3.5'…
-
2
votes2
answers49
viewsHow do I list all fields from one table plus a random value from another table?
I’m having a problem making the relationship with two tables, tb_adm_anuncios and tb_adm_anuncio_banner. For each ad I have 4 banners, and to list these ads I need: **Anúncio:** -Nome do Anúncio…
-
2
votes1
answer42
viewsWhat are covering, Composite and compound compared to Dexes?
I’m reading on Left in Mysql and I came up with three terms that I can’t quite understand that are: covering, Composite and compound. These terms are strongly linked to the use of Dexes, however, I…
-
2
votes2
answers1201
viewsHow to return some* data with time interval?
I have a monitoring system. Recovers user location every 5 seconds. However, I want to show only the records that appear in the interval every 15 seconds (for example). The main idea is that it is…