473,769 Members | 3,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use a subquery to pull particular records including null fields

Hi All,

I have a DB where there are customer numbers and a few other fields. I
want to be able to pull all of the null records for a particular field
as well as all the other customer numbers that have null and non null
fields (see below).

CustNo Funding ClaimAmt Prod
123 R 100 PPO
123 R 200 Null Value
456 N 150 POS
456 N 125 Null Value

I want to be able to get all the customer numbers with null values for
the Prod field, but I want the other records associated with that
customer as well. How do I go about doing that? Thank you.

Paul

Nov 13 '05 #1
1 2285
By default all records will be returned. Are you wanting to limit CustNo to
only those records where CustNo is Null? If so, create a query and add this
table to the query. Add the desired fields to the query (i.e. the fields you
want to see). In the Criteria box for CustNo, add the criteria Is Null. Save
the query with a unique name and open the query. You should have all records
from the table where CustNo is null. Since no criteria was placed on the
other fields, there will be nothing limiting the records by what is in the
other fields, null or not null.

--
Wayne Morgan
MS Access MVP
<Ri*******@aetn a.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi All,

I have a DB where there are customer numbers and a few other fields. I
want to be able to pull all of the null records for a particular field
as well as all the other customer numbers that have null and non null
fields (see below).

CustNo Funding ClaimAmt Prod
123 R 100 PPO
123 R 200 Null Value
456 N 150 POS
456 N 125 Null Value

I want to be able to get all the customer numbers with null values for
the Prod field, but I want the other records associated with that
customer as well. How do I go about doing that? Thank you.

Paul

Nov 13 '05 #2

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

Similar topics

5
1877
by: Haisoo Shin | last post by:
Hello.. I am working on a PHP/PEAR web page that shows statistics of how many people read a certain article during given period of time. I have, say, two tables called 'books' and 'logs'. The 'books' table has fields named 'bookNo', 'bookName', and so on, and 'logs' table has fields named 'bookNo', and 'time'. Whenever somebody accesses a book, I insert a row to the 'logs' table with 'INSERT INTO logs VALUES ($no, NOW());'
3
2354
by: Maarten | last post by:
I've the following problem: Table1 serie | dir Table2 serie | user I am making a webpage in php to administrate the values in the db. What I want is that I select all series from table 1 with an checkbox and
2
14675
by: coryjflynn | last post by:
I am try to update the Gender field for all females of a database with about 15,000 records. So how I started was by searching baby girl names on the web and manipulated some of there lists to create my own table of female first names (HSNames). I can then use this table to update the Gender field to 'F' (female) in the master table. This process works great using the following query... Update HSContacts Set Gender = 'F' Where...
8
1997
by: Neeper | last post by:
I'm trying to pull the last 10 records from a transactions from a table using this query: SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10 But I want to display the rows in ascending order by timestamp. I can't get the subquery below to work and not sure why: SELECT *
8
19600
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
5
4256
by: Mike MacSween | last post by:
This as the row source for a combo: SELECT qryRole.RoleID, qryRole.Role FROM qryRole WHERE (((qryRole.RoleID) Not In (SELECT RoleID FROM qryRoleEvent INNER JOIN qryEvent ON qryRoleEvent.EventID = qryEvent.EventID WHERE ProdID = Forms!frmProductions!ProdID))) ORDER BY qryRole.Role; If there is just one RoleID with a null value in the subquery then the main
0
2021
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
0
2070
by: kiran2nirvan | last post by:
hi please help in solving this i am recieving this error"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression." for the code CREATE procedure . (@frmMasterID int,
19
3277
by: zeusspandex | last post by:
Hello everyone i have 3 fields: 1. Code (Mon01, Mon02 etc) 2. Recycling (Check box, yes or no) 3. Tonnage There are over 10,000 records in this table. I am trying to calculate in a query the percent for each code (Total approx 70), from the sum tonnage for records that are recycling (Check box ticked)
0
9590
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
9424
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
10223
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10051
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
10000
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
9866
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5310
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.