Questions tagged as 'sql'

4
answers

Problem with the use of count in sql

I have a table with the following data named registers : -------------------------------------------------------------- id_plague | id_production | quadrant -------------------------------------------------------------- 4...
asked by 08.09.2017 / 16:11
1
answer

I put the fields in minuscule but Error 1215 still appears. Can not add foreign key constraint

I'm trying to run the script exported from a relational model I did using MySQL WorkBench , but when I try to create the bd I see an error, which I searched, and it tells me that it is due because the name of some fields are in capital l...
asked by 07.09.2017 / 21:52
2
answers

Insert disordered in temporary table

When I do the select only returns the query as I want. Select Distinct NombreCliente,OELMDT,OEQLVA,CodigoCliente,TLLINO,TLTX60 From #Templino,#Tempcliente Where (CodigoCliente=CONCAT(RTRIM(#Templino.OEQLVA),'0000'))OR(CodigoCliente = CONCAT(RT...
asked by 01.08.2017 / 10:36
2
answers

Get the total of all group by

Do you know how I can get the total of a GROUP BY ? Let me explain: a grouping is made per plan and each plan carries its total; I need to get the total of all that. An example is (plan) (cantidad usuarios no admin) costo plan total...
asked by 06.06.2017 / 06:21
3
answers

separate Date and Time

I have the following with the datetime format create table tabla ( f_inicial date not null , f_final date not null , c_almacen varchar (250), sw_costo smallint, sw_consulta smallint, usuario char(30) not null, sw_...
asked by 15.06.2017 / 23:27
3
answers

How to delete the last comma of a concatenation of a sub query in sql? using XML PATH

the following query returns two fields (DATA1 AND DEPARTMENT) THAT ARE VARCHAR SELECT DATO1 ,(SELECT DD.NombreDepartamento + ',' FROM CIALES AS CT INNER JOIN Departamento AS DD ON CT.ID_DEPARTAMENTO = DD.IdDepartamento ORDER BY C...
asked by 04.11.2016 / 23:54
2
answers

sql query related tables

I have two tables in the database. One with fans and another with teams. In the amateur table there is a field that is the team they follow. I need a single query that returns all the fields of the equipment table and also tells me the number...
asked by 22.03.2017 / 11:51
3
answers

Query in SQL using COUNT

I must make a query that shows the number of clients per country. I already have the Country (IdPais, Name) and Client (CustomerID, Name, IdPais) tables, but when I try to do it, I get the error:    "Incorrect syntax near '*'. Expecting HO...
asked by 28.02.2017 / 14:27
2
answers

Fatal error: Call to a member function prepare () on a non-object in

Good morning, when I try to consult a folio on my form I get an error that says:    Fatal error: Call to a member function prepare () on a non-object in Here my code: <?php $serverName = "10.21.22.16"; //serverName\instanceName $conn...
asked by 27.02.2017 / 16:40
2
answers

How to restart sql connections in php

I am programming a system in php that connects to sql , but it has become very frequent that I get this error message:    Warning: mysqli :: mysqli (): (HY000 / 1040): Too many connections in   /home/u442095798/public_html/conexion.php...
asked by 03.12.2016 / 15:56