Questions tagged as 'query'

2
answers

Print consecutive rows of the same column mysqli

I tried printing two consecutive rows of the same column with MySQLi, but I only print the same value. $result = $link->query("SELECT id_papers, name, pen FROM Papers, Pens WHERE id_papers = id_pen_papers"); // la consulta no es exactamente...
asked by 04.09.2018 / 14:50
1
answer

get a data of the last insert made

The case is as follows, I have two related tables in postgres, understand Urbanization and Houses in Urbanizacion we have the following data idurb(PK-NoIncremental,varchar)| nombreurb | calle | idcasas(el campo idcasas es una FK ) and...
asked by 23.10.2018 / 04:11
3
answers

Bring missing items with LEFT JOIN

Starting from two tables lessons lessons.lessons_id, lessons.lesson_number, lessons.course_id entre otras and lessons_completed lessons_completed.lessons_number, lessons_completed.user_id, lessons_completed.completed With the...
asked by 14.08.2018 / 18:15
3
answers

Perform subquery based on a query

As the title indicates, I would like to query a Table "Table1" with the results obtained from another Table "Table2" CONSULTATION 1 To get the data from the Table1 SELECT id FROM box_12.esale_rc WHERE kind=30; which gives...
asked by 05.09.2018 / 19:06
0
answers

How to translate a queryset to subquery in django?

This is my problem I want to group by a field which is a result of an annotate, but I can not do it. from django.db.models import Max, Sum queryset = queryset.values('period', 'cell').annotate(x=Max('total')) result = queryset.values('period')...
asked by 19.07.2018 / 21:24
1
answer

Insert correlative to an ID field in SQL

I'm currently making an export with this Script: /* FromTable 1:Otrntransaction, 2:OtrnTrnTaxAmount, 3:Marckup */ SELECT '1' AS FromTable, T1.ID_Trn AS IdDiarioTrans, T1.PostingDate AS Fecha, T2.AccountNo AS Folio,...
asked by 07.06.2018 / 19:40
0
answers

Parallel Period filter (MDX)

If we have the following query in the [Adventure Works] cube of the BD AdventureWorksDW2014 : WITH MEMBER [Measures].[Previo] AS ( [Date].[Calendar].currentmember.PrevMember,[Measures].[Customer Count]) MEMBER [Measures].[Paral...
asked by 31.01.2018 / 21:12
1
answer

Error executing the DBCC SHRINKFILE command in the Log File of a SQL Server database

The following sql code for the compaction of the log: use My_dabase go declare @arch_log sysname set @arch_log =(select name FROM SYSFILES where fileid = '2') select name from sysfiles ALTER DATABASE My_database SET RECOVE...
asked by 17.01.2018 / 23:26
2
answers

How to make an MYSQL query with WHERE conditional

Good morning everyone, I need help and I do not have an idea I'm putting together a query for a database, which gives me back a result (Table on the left) that contains a list of employees, and the amount that they charged per month. To this...
asked by 17.01.2018 / 21:41
1
answer

Laravel 5.0 Queries WhereIn

Good morning everyone I have the following problem: from the url I pick up a id with which I make a query from which I take out an array. With this array I make another query to get the data I need in another table. The problem comes to me...
asked by 17.01.2018 / 15:53