I've got a single table I need to query to return records that have no
"related records."
Table dataset example:
1. John, Biology
2. Dave, Math
3. Susan, Biology
4. Betty, Sociology
The query should return this dataset:
2. Dave, Math
4. Bett, Sociology
Thanks for any suggestions... 6 2122
Create a query. Pull down first name into the first field of the query grid.
Pull down class into the second field. Pull down class again into the third
field. Change the query to a totals query by clicking on the Sigma button on the
toolbar at the top of the screen. In the third field (class) where it says Group
By, use the drop down list and change it to Count. Enter =1 in the criteria of
the third field.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
"John" <so*********@hotmail.com> wrote in message
news:90**************************@posting.google.c om... I've got a single table I need to query to return records that have no "related records."
Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology
The query should return this dataset: 2. Dave, Math 4. Bett, Sociology
Thanks for any suggestions...
Your request is far from being crystal clear! Your table structure is not
specified and the message subject seems to be the opposite of what I
understand in your message.
If I understand correctly what you need, this should work (change field and
table name for yours):
SELECT Name, Science
FROM YourTable
GROUP BY Science
HAVING COUNT(*) = 1
"John" <so*********@hotmail.com> wrote in message
news:90**************************@posting.google.c om... I've got a single table I need to query to return records that have no "related records."
Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology
The query should return this dataset: 2. Dave, Math 4. Bett, Sociology
Thanks for any suggestions...
The only way I know of to help clear up my question is by giving an
example of what I have. (I know the table is far from being
normalized)
[table]
tbl_Classes:
Student_Name
Class_Name
[table records]
1. John, Biology
2. Dave, Math
3. Susan, Biology
4. Jason, Science
5. Betty, History
6. Larry, Biology
I need a query to return these records:
2, 4, 5
So, I need the query to return only records where the class count (?)
is only equal to one. Since "Biology" occurs in more than one record,
it is excluded from the query results.
This probably won't make sense as to what I'm doing...I'm providing a
simple example of a more complex table.
Thanks again for any help!
"Yannick Turgeon" <no****@nowhere.com> wrote in message news:<4i********************@news20.bellglobal.com >... Your request is far from being crystal clear! Your table structure is not specified and the message subject seems to be the opposite of what I understand in your message.
If I understand correctly what you need, this should work (change field and table name for yours):
SELECT Name, Science FROM YourTable GROUP BY Science HAVING COUNT(*) = 1
"John" <so*********@hotmail.com> wrote in message news:90**************************@posting.google.c om... I've got a single table I need to query to return records that have no "related records."
Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology
The query should return this dataset: 2. Dave, Math 4. Bett, Sociology
Thanks for any suggestions...
The only way I know of to help clear up my question is by giving an
example of what I have. (I know the table is far from being
normalized)
[table]
tbl_Classes:
Student_Name
Class_Name
[table records]
1. John, Biology
2. Dave, Math
3. Susan, Biology
4. Jason, Science
5. Betty, History
6. Larry, Biology
I need a query to return these records:
2, 4, 5
So, I need the query to return only records where the class count (?)
is only equal to one. Since "Biology" occurs in more than one record,
it is excluded from the query results.
This probably won't make sense as to what I'm doing...I'm providing a
simple example of a more complex table.
Thanks again for any help!
"Yannick Turgeon" <no****@nowhere.com> wrote in message news:<4i********************@news20.bellglobal.com >... Your request is far from being crystal clear! Your table structure is not specified and the message subject seems to be the opposite of what I understand in your message.
If I understand correctly what you need, this should work (change field and table name for yours):
SELECT Name, Science FROM YourTable GROUP BY Science HAVING COUNT(*) = 1
"John" <so*********@hotmail.com> wrote in message news:90**************************@posting.google.c om... I've got a single table I need to query to return records that have no "related records."
Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology
The query should return this dataset: 2. Dave, Math 4. Bett, Sociology
Thanks for any suggestions...
John,
Then both PC's solution and mine will work. I'll rewrite mine with your
particular fields and table name:
SELECT Student_Name, Class_Name
FROM tbl_Classes
GROUP BY Class_Name
HAVING COUNT(*) = 1
"John" <so*********@hotmail.com> wrote in message
news:90**************************@posting.google.c om... The only way I know of to help clear up my question is by giving an example of what I have. (I know the table is far from being normalized)
[table] tbl_Classes: Student_Name Class_Name
[table records] 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Jason, Science 5. Betty, History 6. Larry, Biology
I need a query to return these records: 2, 4, 5
So, I need the query to return only records where the class count (?) is only equal to one. Since "Biology" occurs in more than one record, it is excluded from the query results.
This probably won't make sense as to what I'm doing...I'm providing a simple example of a more complex table.
Thanks again for any help! "Yannick Turgeon" <no****@nowhere.com> wrote in message
news:<4i********************@news20.bellglobal.com >... Your request is far from being crystal clear! Your table structure is
not specified and the message subject seems to be the opposite of what I understand in your message.
If I understand correctly what you need, this should work (change field
and table name for yours):
SELECT Name, Science FROM YourTable GROUP BY Science HAVING COUNT(*) = 1
"John" <so*********@hotmail.com> wrote in message news:90**************************@posting.google.c om... I've got a single table I need to query to return records that have no "related records."
Table dataset example: 1. John, Biology 2. Dave, Math 3. Susan, Biology 4. Betty, Sociology
The query should return this dataset: 2. Dave, Math 4. Bett, Sociology
Thanks for any suggestions...
Thanks for the help, Yannick and PC...I was able to use your suggestions. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bryan Zash |
last post by:
When querying a bit field, I am encountering a problem with MS SQL
Server returning a larger number of records for a table than the
actual number of records that exist within that table.
For...
|
by: kinane3 |
last post by:
I'm guessing this has something to do with my cursor but I'm not sure.
this is for a picture gallery app and when I upload pictures some
pictures or records don't show up. this is what ia have so...
|
by: Florian |
last post by:
Hi Uthuras,
it would be helpful to see the access path. However sometimes it makes
sense to rewrite a "not in" to gain better access paths:
I tried the following - hopefully similar -...
|
by: DataFreakFromUtah |
last post by:
Hello!
No question here, just a procedure for the archive.
Search critera:
count records imported count data imported count number of rows
imported
count number of records imported record import...
|
by: Greg Smith |
last post by:
I am trying to write a SQL query that will return a record count to my C#
application. I wrote the following query:
ALTER PROCEDURE up_justification_duplicate
AS
SELECT COUNT(*)
FROM...
|
by: dbarker1 |
last post by:
Hello All,
I am developing a web front end using the standard datagrid in the 1.1
framework. Currently it allows users to navigate through records 20 at
a time via previous and next buttons. ...
|
by: max |
last post by:
I am beginning to learn sql and need some help.
I have a table of customers with their addresses. Let's say I want to
run a query returning the number of customers whose last name is
"Smith" by...
|
by: Catch_22 |
last post by:
Hi,
I have a stored procedure that has to extract the child records for
particular parent records.
The issue is that in some cases I do not want to extract all the child
records only a...
|
by: noLoveLusT |
last post by:
hi everyone i am very very new to the sql server (2 days actually and ) so
far i learned creating SPs etc but couldnt workout how to get return value
from my prodecure
my sp as follows...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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: 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...
| |