Questions tagged as 'mysql'

1
answer

My form does not send to the bank

I created a form to save data in the MySql database, but it is not working as expected. I'm having trouble identifying the problem because no error appears, the page just refreshes. Table in the Bank: id_contato (int11 aI) , n...
asked by 22.03.2018 / 20:56
1
answer

Compare records between two tables in MYSQL

I need a solution that compares any changes you've made to the products_csv table against the products table ( letter or number ) in some field. I'm using the code below but only works for single records because if there are duplicat...
asked by 22.03.2018 / 20:02
2
answers

How to make a count work by getting only the fields I want?

How can I get a field I want to make COUNT work? select PVN.NFNum, COUNT(distinct CtrlCargaNum) as Qtd from CTRL_CARGA cc INNER JOIN PED_VENDA_NOTA_FISCAL PVN ON cc.EmpCod = PVN.EmpCod where cc.CtrlCargaData between '2018-01-01' and '...
asked by 15.03.2018 / 21:30
1
answer

Presentation of the chart on page

I have this chart with the following query to the database: <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><scripttype="text/javascript"> google....
asked by 15.03.2018 / 16:24
2
answers

How do I count the number of items in a field repeated?

I have a table with the field CtrlChargeNum that has the log of the number of the load of a truck. I need to make a query that brings the total of that field. Until I got the query, see: SELECT COUNT (*) CtrlCargaNum FROM CTRL_CARGA WHERE Ct...
asked by 15.03.2018 / 20:48
1
answer

Date Minor and Greater than X days MySQL [duplicate]

I have a field in the table named registro_data_instalacao of type date , I need to display the records with registro_data_instalacao where the date is greater than 3 days and less than 30 days, below, but to no avail. SELECT...
asked by 08.05.2018 / 16:31
1
answer

SQL query help

I have 3 tables: Company: id integer nome string category: id integer idEmpresa integer nome string tag: id integer idEmpresa integer nome string I'm querying as follows: SELECT distinct(e.nome), e.id, e.logo FROM empresas e,...
asked by 01.04.2018 / 18:00
1
answer

How to use If with Insert in MySQL?

I have a variable x, and I want to check the value of it with an if, and if the value is above 10 (for example) I want to perform an insert on a table, otherwise a select on it. It's relatively simple, but I can not seem to find it because in...
asked by 06.03.2018 / 17:46
1
answer

How to do a SELECT with SUM and DISTINCT?

I need to make a select in the bank using sum and distinct. I tried this: SELECT DISTINCT 'conta_idconta', SUM(valor) AS ValorTotal FROM contaSaida WHERE conta_empresa_idempresa=1 AND conta_subcategoria_idsubcategoria=4 AND data BETWEEN 2017-0...
asked by 06.03.2018 / 19:51
1
answer

Insert multiple ids into a table

Hello, I have the following problem: I have the PERSON table and COURSE table, each person can choose more than one course, the id of the chosen courses need to be saved within the person table, what would be the best way to do it?     
asked by 08.06.2016 / 02:49