473,383 Members | 1,952 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,383 software developers and data experts.

How do I compare records criteria in a single table?

I have a table containing an airline's complete flight listings for a month. Using Group By I have made another table containing all the flight numbers with unique properties other than date departing (eg flight number 2322 appears in the table twice, departing at 09:00 and at 09:10 on another occasion). Most flights leave at the exact same time so only appear in the table once.

I am trying to list any flight with really inconsistent flight times (flight number 165 appears 3 times, departing 11:15, 11:25 and also at 19:40). I have a field named "dur_loc" which shows the number of days "local duration" in days that the flight covers. A 'there and back' flight usually has "dur_loc" of 1 (day). If the flight goes through 'local midnight' it has a "dur_loc" of 2. Layover flights might have a "dur_loc" of 3 or more days.

Right now I have to manually search through the record list to find flight records with the same flight number and then check the "dur_loc" is the same. I need to pick out records where the "dur_loc" field differs for the same flight number.

Any thoughts on a methodology for this? Many thanks.

Jun 12 '19 #1
1 1230
NeoPa
32,556 Expert Mod 16PB
You can produce the Max() & the Min() of any value within a group in your query. If the difference between the two is greater than some specified threshold then you have identified those groups that interest you.

With [Dur_loc] you can either separate them into different groups by including the field in the GROUP BY clause or, if you want to highlight them within a single group then, again, use Max() & Min() and compare them.
Jun 12 '19 #2

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

Similar topics

3
by: Peter Phelps | last post by:
My problem is as follows: I need automatically iterate through a single field in a table and use the values in the field to create an in-statement. Currently, the character limitation in the...
6
by: Sven Pran | last post by:
Probably the answer is there just in front of me only awaiting me to discover it, but: 1: I want to build a query that returns all records in one table for which there is no successful "join"...
2
by: MLH | last post by:
Gentlemen: I have declared an array Dim MyTables(14) AS Long Now I want to assign values for MyTables(0) - MyTables(14) equal to the number of records in each table. Catch, I want the code...
10
by: hibbii | last post by:
Could someone help me write a query or code that allows me to compare records based on the quarter? For example, in my table all the records have the PK set as (DCN & Quarter). The DCN is usually...
2
by: darrel | last post by:
HI there a newbie here in Visual Basic i just wanted to ask something, on how can compare records in a particular field in my table... I'am develop a time scheduling system, its like for example i...
1
by: darrel | last post by:
HI there a newbie here in i just wanted to ask something, on how can compare records in a particular field in my table... I'am develop a time scheduling system, its like for example i have a table...
0
by: NasirMunir | last post by:
I am trying to compare records from oracle table with a table in access. With oraDynaset, I have the option of .findNext function. I can use that to look for matching records from access to oracle....
5
by: binky | last post by:
Question for all you SQL gurus out there. I have a (seemingly) complex query to write, and since I'm just learning SQL server, am not sure how to go about it. Tables: t_trans t_account All...
2
by: jjwiet | last post by:
Hello, I use access 2003 and attempting to export/copy records between two access databases (almost identical) with multiple tables (both databases having the same relations between the tables)....
12
by: anand padia | last post by:
I have a master access table where we store all the employee information. I have various application developed in excel which imports and uses information in master. Now I want to develop a excel...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.