» Home » Records » Page 1
Excluding certain records from a Django queryset as long as those records are not the first or last X records
Category : Web Design

I have a Django recordset (mysource) holding temperature reading for each day (for_date). When the last 40 days readings are available for me, for example, I want to display only 20 days on a graph. To accomplish this, I do the following:

for day_num in range (1, 32):
if day_num % 2 == 1: # remove every 2nd day
mysource = mysource.exclude(for_date__day=day_num)

View Replies

Custom Paging in Sql ,to display 10 records in Repeater ,and the records change with the submit button
Category : Programming Languages

There are 4 table

Table 1---->QuestionMaster(Field is-->Id,Question).
Table 2---->SurveyMaster(Field is---->Id,Name)
Table 3---->SurveyQuestionMap(Field is--->Id,SurveyId,QuestionId)
Table 4---->SurveyRateMap(Field is--->Id ,SurveyId, RatingTypeId)

The Stored Procedure is

ALTER Procedure [dbo].[GetQuestio

View Replies

How can you check for foreign key references for a list of records before attempting to delete any of these records in MySQL?
Category : Databases

Is there a way, when you have a list of records, to check if each of these records have foreign key references before you attempt to delete any of these records?

As an example, if I have a list of borrowers and a list of books, you should not be able to delete a borrower from the system if he still has books on loan. (My actual system is much more complicated than that however - a l

View Replies

In SQL Server what is most efficient way to compare records to other records for duplicates with in a given range of values?
Category : Coding

We have an SQL Server that gets daily imports of data files from clients. This data is interrelated and we are always scrubbing it and having to look for suspect duplicate records between these files.

Finding and tagging suspect records can get pretty complicated. We use logic that requires some field values to be the same, allows some field values to differ, and allows a range to

View Replies

LINQ, Lambda Expression Skip n records, while averaging the skipped records
Category : Programming Languages

I have an expression:

Records.OrderBy(o => o.TIME).Where((o, i) => i % interval == 0).ToList();

This does an alright job at taking a large list of data records and paring it down to a smaller list. (interval is the number of records to skip). The problem is, I want to average out some of the fields, and not just skip them. I have no idea how to do th

View Replies

Need help to inserting 100 records in loop, continue where it stop from and break once the records are completed.
Category : Databases

Need help to inserting 100 records in loop, continue where it stop from and break once the records are completed.

DECLARE @BatchId INT = (SELECT BatchId FROM Tracker)
declare @Count int
declare @batchsize int
set @batchsize = 100
--set @Count = @@rowcount

View Replies

Find which pairs of records' positions can safely be switched in a combined set of records
Category : Databases

Here is the situation: I have a page where I can edit multiple records at once (Let's say invoices). They are not shown below each other, but they are edited like one record. At page load, values are displayed in a given field only when they are the same throughout the whole set of records.

Now, on top of that, I also want to edit child records (1-n relationship; lines of invoice).

View Replies

How do I Iterate through a small set of records and retrieve records that match criteria set in each record
Category : Databases

I have a table tblCriteria that contains a small (<20) set of records. Each record has a field of criteria.

I want SQL to move through these records when requested tblFilterRun, filter the main table tblRecords (~5000 records) and then insert some key fields from the matching records into another table tblFilterResults.

View Replies

Removing duplicate records based on three cols but keeping the records with the highes value in a forth col
Category : Databases

I've read alot of the questions on dealing with duplicates and they have helped me write the SQL I do have, but my quest is to remove the duplicates not based on the duplication fields, but on another field.

In my project I'm defining duplicates based on three cols being equal, but there is a forth col transaction date/time that will never* be duplicated. I want to keep the newest

View Replies

Records Access is very slow in rails with mysql havin table records 80K+
Category : Databases

I have a model named website which is having 80K+ records. I am getting those records through
kaminari pagination in index page.

Here is the code for getting the list in index

@q = current_user.organization.websites.where('website !=""').group('website').search(params[:q])
@websites = @q.result.page(params[:page]).per(50)

My Problem her

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .