473,856 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing data in two consecutive rows from a single table

I'm trying to come up with an elegant, simple way to compare two
consecutive values from the same table.

For instance:

SELECT TOP 2 datavalues FROM myTable ORDER BY timestamp DESC

That gives me the two latest values. I want to test the rate of
change of these values. If the top row is a 50% increase over the row
below it, I'll execute some special logic.

What are my options? The only ways I can think of doing this are
pretty ugly. Any help is very much appreciated. Thanks!

B.
Jul 20 '05
22 24681

"--CELKO--" <jc*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
Banners are delivered as often as the clicks the page. If they go
to a page, read the page, walk away and come back 3 weeks later, the
same banner is still displayed. If they go to a page, quickly see
it's not what they want and click a link to another page, then they'll
get a different banner. <<

I would make a big distiction between the banner (the thing that leads
to my Christmas sale) and the image of the banner that has presisted
for weeks after the holidays in the local storage of a particular
machine.


You might, but that's irrelevant. I'm discussing what the viewer sees on
the screen.
My contract was for a duration (Christmas season) and was
with the website that offered to run my banner. They were to display
from one date to another. If it got clicked (n) times between
December 01 and December 25, then I owe them according to some
formula. Maybe if the click leads to sale between December 01 and
December 25, then I owe them according to another formula. But
outside that (possibly open ended) duration, there is no obligation.
You're discussing the contract, I'm discussing the serving, those are two
distinct tiems.

Ask them how long each individual banner was displayed on an end-user's
system (the "duration" as you're referring to it.) They can't do it. (and
if they claim they can, they are most likely fudging some of the data).


Years ago in Los Angeles, I worked on a data model for a cable TV
shopping network for a major department store chain. This was even
worse because each time a commerical played, we had to compute the
actor's residuals, the assorted union pay rates, and how to credit the
purchase to the nearest local store, and the right department within
that store. Arrgh!


Years ago I was involved as a sub-contractor (big mistake) on a system for a
major network who shall remain nameless. System was to handle the
scheduling of commercials on the network and had to deal with all sorts of
items such as regional variations within a broadcast (might show snow-tire
commercials up north while showing a vacation commercial down south.) At
that time I wasn't too involved with the schema, but more so the hardware.
It was an interesting situation trying to deal with handling things like
failures and having to predict the required hardware for a reload (forget
the number of transactions that would have to occur in 10 minutes but at the
time, it was a fairly impressive number. Of course the contractor I was
working for kept saying, "Oh, don't worry, the hardware can handle it." I
was the one that kept saying, "no, we have to model this." (generally I've
got enough faith in "gut instinct" I can model some systems in my head, this
was definitely not one of them.)

Anyway, I just thought of a good distinct here.

Whereas things like commercials have a fixed run time, etc. serving banners
is more like blow-ins in the newspaper. You contract for a specific number
over a specific time, but generally don't care about the exact time the
blow-in is blown-in (and can't model when the reader actually reads it or
tosses it in the trash.)

Yes, the contract has a duration which is critical to model (i.e. when to
start serving, stop serving) but the individual serving is only an
"instant."

Jul 20 '05 #21
-P-
"Greg D. Moore (Strider)" <mo************ ****@greenms.co m> wrote in message
news:dS******** ***********@twi ster.nyroc.rr.c om...

"--CELKO--" <jc*******@eart hlink.net> wrote in message
news:18******** *************** ***@posting.goo gle.com...
> Serving them has no duration, no. And we serve (and record the serving) of over 14 million banner ads a day. <<


<snip>
Banners don't have a duration. (Well, active content do, but let's come
back to that.).

So, given the criteria you've given, we'd charge you probably (and this
varies but for this we simplify) on number of impressions. I.e the number
of times it's been served.

So an end user goes to a page on our site. The code (generally ASP) goes to
a DB table and queries "what banner should I show." (there may be more than
one scheduled for say the top position on the page). A "coin flip" is made
and the DB hands back a URL to the banner in question. At that point it
records in the database that your banner was served.

Sounds like a Traffic system to me... ;)
We do the same thing for Television advertising. We should talk...

--
Paul Horan
Sr. Architect
Video Communications, Inc.
www.vcisolutions.com

Jul 20 '05 #22
-P-
Joe,
I think what you're missing in this discussion is the distinction between the ORDER for an impression and the audit
trail of the DELIVERY of that impression.

Both Greg and I work in the Advertising "Traffic" business. Our respective software products are basically Order
Fulfillment processes - my company writes Traffic software for television stations, and Greg's company works in the
internet medium.

The attributes of an Order most definitely DO contain "duration" - both a start_date/end_date duration (so that you
don't run Christmas special ads in February - we call those discrete periods of time a "flight"), as well as two columns
for storing the start/end time within which the spot should "air". Some advertisers only want their spots to be seen in
"prime time", for example...

Our TV clients are also concerned with the duration of the spot itself. Is this a regular :30 second spot? a :15? a
28:30 infomercial? Greg's clients don't have that concept - but I'm sure they do have X/Y and width/height parameters.
Once the HTML is rendered and delivered to the browser, that is officially recorded as one "impression " that happened at
a specific nanosecond in time.

We collect the order "parameters " as attributes of the Order entity itself. Then comes the process of matching up
Orders and available "Inventory" , and delivering the content. We print out a daily program log so Master Control knows
which commercials to air in what order, and Greg serves up links to banner ads in "real-time". All that's left is the
recording of that delivery, so that the advertisers (or ad agencies) can pay their bills.

--
Paul Horan[TeamSybase]

"--CELKO--" <jc*******@eart hlink.net> wrote in message news:18******** *************** ***@posting.goo gle.com...
Banners are delivered as often as the clicks the page. If they go

to a page, read the page, walk away and come back 3 weeks later, the
same banner is still displayed. If they go to a page, quickly see
it's not what they want and click a link to another page, then they'll
get a different banner. <<

I would make a big distiction between the banner (the thing that leads
to my Christmas sale) and the image of the banner that has presisted
for weeks after the holidays in the local storage of a particular
machine. My contract was for a duration (Christmas season) and was
with the website that offered to run my banner. They were to display
from one date to another. If it got clicked (n) times between
December 01 and December 25, then I owe them according to some
formula. Maybe if the click leads to sale between December 01 and
December 25, then I owe them according to another formula. But
outside that (possibly open ended) duration, there is no obligation.

Years ago in Los Angeles, I worked on a data model for a cable TV
shopping network for a major department store chain. This was even
worse because each time a commerical played, we had to compute the
actor's residuals, the assorted union pay rates, and how to credit the
purchase to the nearest local store, and the right department within
that store. Arrgh!

Jul 20 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2933
by: Vorpal | last post by:
Here is a small sample of data from a table of about 500 rows (Using MSSqlserver 2000) EntryTime Speed Gross Net ------------------ ----- ----- 21:09:13.310 0 0 0 21:09:19.370 9000 NULL NULL 21:09:21.310 NULL 95 NULL 21:10:12.380 9000 NULL NULL 21:10:24.310 NULL 253 NULL
41
3979
by: Odd-R. | last post by:
I have to lists, A and B, that may, or may not be equal. If they are not identical, I want the output to be three new lists, X,Y and Z where X has all the elements that are in A, but not in B, and Y contains all the elements that are B but not in A. Z will then have the elements that are in both A and B. One way of doing this is of course to iterate throug the lists and compare each of the element, but is there a more efficient way? ...
2
4200
by: Bung | last post by:
Hi, I am not really familiar with MS ACCESS. However, I am trying to make some reports where you compare current data from a table with old data from the same table. What I'm saying is we have a database with current data, and the same database with old data. I need to create reports for new rows inserted, deleted rows, and updates rows. I'm having trouble figuring how to query which rows have been updated (meaning the primary...
0
1695
by: laxmiuk | last post by:
I've original version of a table called PMM (Product Material Master). Thro' a web interface, user can change that table contents. Once changed, i need to raise an ECN (Engineering CHange Note) specifying what changes happened to original PMM table whether rows are deleted, new rows are added or existing rows are modified etc. I've both old and new version of PMM tables. The difference between two PMM tables are captured in a third table...
17
3040
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). I have a dataset as follows (1 week to keep it short): Employee 1 - Date 1 Employee 1 - Date 2
0
3771
by: varac | last post by:
Hi list, I am new to mysql and would appreciate any advice that you have to offer. I am attempting to batch insert 100 rows into a table, and I need to know the 100 id's of all the inserted rows. I know that I can find the id of the last inserted row despite my app being multi-threaded, since the select last inserted command is connection-specific.
2
2955
by: Beliavsky | last post by:
How can I replace multiple consecutive spaces in a file with a single character (usually a space, but maybe a comma if converting to a CSV file)? Ideally, the Python program would not compress consecutive spaces inside single or double quotes. An inelegant method is to repeatedly replace two consecutive spaces with one.
1
1591
by: Mike | last post by:
Hi All, I'm using vb.net as my codebehind lang. and the following code is being executed in my aspx.vb page to stamp a DB row. Dim oStatsInfo As New StatsInfo(CartID, Batch, Set, Num, 0, 0, 0, 1, 0, 1) Dim oStatsStamp As New Stats(_DataSource, oStatsInfo) Dim tStamp As New Threading.Thread(AddressOf oStatsStamp.StampStatsList)
3
1267
by: emeped | last post by:
I am using C#.NET 2003. Please I want to know if it is possible and how to insert the same data into 2 or more consecutive rows in a datatable column, at the same time, by a single click of a button. Data will be from a textbox bound to the column. Thanks.
0
9903
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9754
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10692
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10769
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9526
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7927
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5754
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4567
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.