Questions tagged as 'mysql'

1
answer

Sort the latest entries according to the registration date

Sort the last ads registered in mysql, with the dates closest to the current date using PHP The field type (date) in mysql is as (date) This is my query : SELECT * FROM frame_anuncio WHERE ativo = 'Sim' ORDER BY destaque ASC LIMIT $inicio...
asked by 07.05.2014 / 14:40
1
answer

Incorrect usage of UNION and LIMIT

I want my query to return only the first record of the first table (if there is data in it), because the second table does not have repeated data. But it returns me this error:    Error Code: 1221. Incorrect usage of UNION and LIMIT My...
asked by 22.11.2018 / 15:50
1
answer

How to install a java application with MySQL database?

I'm developing a java desktop application, with java swing and MySQL database. But I need to install this application on multiple machines and I would like to know an easier way to do this, without having to install MySQL on all machines. Is...
asked by 23.11.2016 / 14:38
2
answers

Update involving 3 tables

I have 3 tables: TABELA A ID ID_TABELA_B 1 188 2 189 3 190 4 200 TABELA B ID ID_TABELA_C 188 22 189 22 190 22 200 23 TABELA C ID NAME 22 Gato 23 Cão Table A is linked to table B and table B linked to t...
asked by 23.04.2015 / 17:36
4
answers

Mysql error 1054 Unknown column

I'm doing a SQL that counts how many names in the table begin with any letter but an error is being returned:    Column not found: 1054 Unknown column 'A' in 'where clause' For the following SQL: SELECT COUNT(*) FROM author WHERE name L...
asked by 27.04.2015 / 14:39
2
answers

Knowing if the date is between two columns of MySQL - Bank?

I made the code below and it works, the check is done if the date is contained between the two columns and returns the result.: SELECT * FROM 'ips_bloqueados' WHERE ip = '::1' AND '2015-04-18' BETWEEN date(inicio) AND date(fim) But I woul...
asked by 18.04.2015 / 14:58
2
answers

Data mismatch with inner JOIN using PDO

Hello I'm having problems when I'm returning a select done with inner join from some tables as below: SoIsetupaninnerjoinwithmyneedsinmymethod:publicfunctiontableUsuarioUM(){$consulta=PDOUtil::getStance()->prepare("SELECT pes.id_pessoa, pe...
asked by 23.05.2015 / 20:52
1
answer

Condition of a query with a subquery

I need to update the last 110 records of the relevo table, however my problem is in the subquery in WHERE . I'm doing it this way: UPDATE relevo SET id_projeto = 157 WHERE id_relevo = (SELECT id_relevo FROM relevo ORDER BY id_...
asked by 09.09.2018 / 00:50
2
answers

How to do integrity validation when trying to save duplicate data to the database?

Context: When attempting to register the Structure Checklist object, the following error occurred: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-5' for key 'un_checklist_estrutura' (SQL: insert into che...
asked by 28.08.2018 / 16:59
1
answer

Scale of services by turns in php

I plan to create a monthly shift schedule. I have 4 turns: T.M = Morning shift (11 helpers this shift, but each day    3) T.T = Afternoon shift (there are 5 aids this shift, but each day       2) T.I = Intermediate Shift (there are...
asked by 26.10.2018 / 10:02