473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

merging rows for the same time stamp

Hi,
My question is about retrieving single records based on a time column, i mean the result set should not include duplicate rows for a unique time value as an example:

A B C D Time
-------------------------------------------------------------
x x x x 1
y y y y 1
z z z z 2

should return either.
{x x x x x 1, z z z z z 2} or {y y y y y 1, z z z z z 2}
The selection of the row for the same time is not important

Actually i want this statement to be executed based on two parameters: one the number of rows to be returned, second the time value that Time column should have a greater value than. The statement should be capable of returning a specific number of rows with a Time value greater than a specific time

In the second case, i need a more complex query that shoul extract one exact row from multiple rows for the same time. Here is the example table:

A B C D id Time
------------------------------------------------------------------------
x NULL x NULL 1 1
NULL y NULL y 1 1
z NULL z NULL 1 1
NULL w NULL w 1 1
x NULL x NULL 2 1
NULL y NULL y 2 1

Here i want a complete record for each id at specific time. sample resultsets are as follows:
{x y x y 1 1, x y x y 2 1} or
{z w z w 1 1, x y x y 2 1} . again the merging strategy is not important, but this statement should also be capable of returning a specific number of rows with a Time value greater than a specific time

Thanks
Sep 4 '09 #1
1 1764
ck9663
2,878 Expert 2GB
You might want to check if you can PIVOT/UNPIVOT your table.

Happy Coding!!!

--- CK
Sep 5 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then...
2
by: Klatuu | last post by:
Whew, I've struggled my way through figuring out how to use XML to transport data..now I can imagine what having a baby is like :) But, I'm stuck now. I generate the XML (single table, no...
7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
3
by: Ralph Smith | last post by:
I have two identical databases on two different servers and I need to add the data in tables from one server to the tables in the other server. Is there a way to do that in mysql? thanks, Ralph
5
by: joe donnelly | last post by:
I have a couple of questions about recordsets: 1. When a recordset is summoned by the code where does it actually exist and in what form...is it created in the database (data source location)...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
6
by: dannylam4 | last post by:
Hello, I've got a question about merging/concatenating rows. There's a similar topic here: Combining Multiple Rows of one Field into One Result but I didn't know if I should hijack it. Basically, I...
2
by: Neil Chambers | last post by:
I am trying to get my head around dataset merging but despite a little research I could still use a pointer (or ten). Basically I want to perform an outer join operation on a dataset (created from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.