Questions tagged as 'query'

1
answer

Different results in distinct

I have a query. In Oracle the column NUM_DISTINCT of the table table ALL_TAB_COLUMNS showing the number of different values throws me a number that if I compare with the following statement, I get different data: select count(distinct(CUST...
asked by 17.10.2017 / 19:16
2
answers

Problem with complex PostgreSQL query

Please, I need help with a query in PostgreSQL The query is as follows: SELECT DISTINCT("ventas"."Product Category") AS "Categoria de Producto", (EXTRACT(MONTH FROM "ventas"."Order Date")) AS "Mes", "ventas"."region" AS "Región", "ventas"."...
asked by 03.11.2017 / 09:52
1
answer

Query with pivot table - SQL Server 2014

I have 3 tables: Persona(IdPersona(PK), NombreYApellido, IdTelefono); Telefono(IdTelefono(PK), Numero, IdTipoTelefono); TipoTelefono(IdTipoTelefono(PK), Descripcion); To relate them I created the table PersonasTipoTelefono(IdPers...
asked by 07.09.2017 / 17:18
2
answers

SQL Query to add fields from different tables

Someone who can help me with this query. I have three tables with different names. Tabla Ejemplo1 fecha campo1 2017-01-01 0.00 2017-01-01 7.00 2017-01-01 0.00 2017-01-01 1.00 2017-01-01 0.00 2017-01-02 1.00 2017-01-02...
asked by 08.08.2017 / 10:17
1
answer

Check dates in Django

I want to obtain data on the same date from this query: Example: fecha_inicio= 06/09/2017 fecha_final= 06/09/2017 query=DetalleParte.objects.filter(fecha_creacion__range=(fecha_inicio,fecha_final) However the Query only brings me da...
asked by 06.09.2017 / 17:24
1
answer

MySQL: multiple conditions to different columns in MySQL

I want this question to come out in a single row: select (case month(p.fechaVent) when 1 then sum(p.totalVent) end) AS "ENERO",(case month(p.fechaVent) when 2 then sum(p.totalVent) end) AS "FEBRERO" from proformas p group by mon...
asked by 03.07.2017 / 21:09
1
answer

Get date field by subquery

Dear, I am working in the construction of a stored procedure, I need to obtain a date field from a Table B depending on a particular state, by means of a subquery in a table A, I explain: Table A contains a product and table B stores the histor...
asked by 21.06.2017 / 18:17
1
answer

problem with multi query PHP mysql

Hello people, I do not know why this code does not work for me (print "you can not create the date") and I have seen on the internet that multicary is done in this way, here I leave what I did, regards    * CLARIFICATION: this is the part of...
asked by 22.04.2017 / 03:41
1
answer

Error creating and executing stored procedure

I am trying to create a stored procedure which verifies all the projects in my database and gives me for each project a series of elements that I need. When trying to do this, the procedure bugs me with an error Must declare the scalar var...
asked by 24.04.2017 / 21:34
2
answers

Query mysql, count records by date [closed]

I have a little problem. I need to generate a query in this way: +-----------+------+-------+---+---+ | nombreSol | Enero|Febrero|...|Dic| +-----------+------+-------+---+---+ | pedro | 1 | 5 |...| 2 | | juan | 3 | 6...
asked by 26.01.2017 / 18:32