Questions tagged as 'sql'

1
answer

Doubt of how to make multiple inserts

I have a problem when I want to add a rent I want to generate several inserts to the payment table depending on the quantity and I do not know how to do it Example insert into Alquiler values('48265014',1000,1,getdate(),'19/11/2017',300.00...
asked by 19.10.2017 / 22:56
2
answers

Operation of a right or left in multiple join (Postgres)

I am trying to create a query for a library database that meets the following requirements: the number of books written by authors of Spanish nationality who they lived in the second half of the 20th century by editorial, together with the name...
asked by 19.10.2017 / 17:49
1
answer

Import EXCEL file (xlsl) to Table

What I need is to be able to load the data of an Excel sheet to a table. I already tried with bcp. Also with Bulk Insert and finally enabled: sp_configure 'show advanced options', 1; RECONFIGURE; GO sp_configure 'Ad Hoc Distributed Queries'...
asked by 17.10.2017 / 16:19
1
answer

Query shows different data each time I execute Mysql

I have the following query: SELECT pr_production_units_details.id AS idProductionUnit, pr_production_units_details.production_units_detail AS productionUnit, IF(pr_varieties.variety IS NULL, 'SIN SEMBRAR O ERR', pr_varieties.variety) AS variet...
asked by 17.10.2017 / 14:34
1
answer

Query with fields from different tables

I am setting up a CRUD and I want to join fields from different tables, this would be: Customers table: customer, first and last name Invoice table: ID and quantity The code of the SELECT would be: $id = $_GET[ "IdCliente" ]; $no...
asked by 16.10.2017 / 21:19
1
answer

Dinamic Roles in Symfony2

Good I have that piece of code, I have the class "Users" and the class "Roles", in this fragment the getRole () method, perfectly gets the user name of the class users, at this point return 'ROLE_' strtoupper ($ this-> user-> getUsername ());...
asked by 14.10.2017 / 05:42
2
answers

Add value of a table related to itself

Hello I have a question about how to make a query in sql to add the total time it takes to produce the product. The diagram is a table of products that has sub-products, the design is an NN relationship with itself so I made an auxiliary tabl...
asked by 13.10.2017 / 12:04
1
answer

List data omitting repeated and add them in MySQL

I have the following table: Payments and the fields you have are idpagos , codigo_empleado , fecha_pago , trimestre , monto_pago The payment quarter is because the employees are paid 15 and last of each month...
asked by 12.10.2017 / 18:19
2
answers

Query that works in SQL and not in PHP

I have a code like this: $consulta= "select campo1, campo2, .. from tabla where fecha >'2017-10-12 9:42' order by fecha asc"; echo $consulta; /*lo tengo para hacer pruebas */ $filas = $db->query($consulta); if (!$filas) { $err...
asked by 12.10.2017 / 08:10
2
answers

Create a view in sql that collects employee and salary data

I am doing a job for the school, in which they ask me to make a view that collects the following data: ID of the employee, name and surname, salary, maximum salary and% of the current salary with respect to the maximum (I do not understand th...
asked by 15.10.2017 / 09:37