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

Help needed with SQL Select

My goal is to select Vendors that have not had any activity after a
given date. The table Orders has all activity from each order. Most
vendors will be listed multiple times with activity in several years.

Below is my Select statement:

SELECT Distinct Vendor
FROM Orders
WHERE update_date < #01/01/2002#

I am using "Distinct", because I don't need to see vendors more
than once. As the statement is written, it shows each Vendor that had
activity before 01/01/2002. How can it be rewritten to show Vendors
that do not have activity after that date ?

Thank you for your assistance.

Dig

Feb 21 '06 #1
8 1257
Change the "<" To ">".

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
<di****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
My goal is to select Vendors that have not had any activity after a
given date. The table Orders has all activity from each order. Most
vendors will be listed multiple times with activity in several years.

Below is my Select statement:

SELECT Distinct Vendor
FROM Orders
WHERE update_date < #01/01/2002#

I am using "Distinct", because I don't need to see vendors more
than once. As the statement is written, it shows each Vendor that had
activity before 01/01/2002. How can it be rewritten to show Vendors
that do not have activity after that date ?

Thank you for your assistance.

Dig

Feb 21 '06 #2
Thanks for the prompt reply. Changing the "<" To ">" will show vendors
that have had activity after that date. I need to see vendors that have
NOT had activity AFTER the date.

To put it another way, I need to see vendors that were used in 2001 (or
earlier), but have not been used since 2001.

Dig

Feb 21 '06 #3
Save your original query and then use that query as the the basis for a
new query. For example, if you named your original query 'MyQuery' you
could create a second query with the following SQL:

select distinct Vendor
from Orders
left join MyQuery
on Orders.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

If you have a Vendors table it might be preferable to use that to link
to your MyQuery query rather than use the Orders table again, e.g.

select Vendor
from Vendors
left join MyQuery
on Vendors.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

HTH,
Bruce

Feb 21 '06 #4
Save your original query and then use that query as the the basis for a
new query. For example, if you named your original query 'MyQuery' you
could create a second query with the following SQL:

select distinct Vendor
from Orders
left join MyQuery
on Orders.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

If you have a Vendors table it might be preferable to use that to link
to your MyQuery query rather than use the Orders table again, e.g.

select Vendor
from Vendors
left join MyQuery
on Vendors.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

HTH,
Bruce

Feb 21 '06 #5
Save your original query and then use that query as the the basis for a
new query. For example, if you named your original query 'MyQuery' you
could create a second query with the following SQL:

select distinct Vendor
from Orders
left join MyQuery
on Orders.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

If you have a Vendors table it might be preferable to use that to link
to your MyQuery query rather than use the Orders table again, e.g.

select Vendor
from Vendors
left join MyQuery
on Vendors.Vendor = MyQuery.Vendor
where MyQuery.Vendor Is Null

HTH,
Bruce

Feb 21 '06 #6
Do you actually read the requests before replying?

John... Visio MVP

"PC Datasheet" <no****@nospam.spam> wrote in message
news:pe****************@newsread1.news.atl.earthli nk.net...
Change the "<" To ">".

PC Datasheet

Feb 21 '06 #7
Dig, this is aircode, totally untested, but I think what you want is this:

SELECT Vendor
FROM Orders
Group By Vendor
Having Max(update_date) < #01/01/2002#

Hope it helps -

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
<di****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
My goal is to select Vendors that have not had any activity after a
given date. The table Orders has all activity from each order. Most
vendors will be listed multiple times with activity in several years.

Below is my Select statement:

SELECT Distinct Vendor
FROM Orders
WHERE update_date < #01/01/2002#

I am using "Distinct", because I don't need to see vendors more
than once. As the statement is written, it shows each Vendor that had
activity before 01/01/2002. How can it be rewritten to show Vendors
that do not have activity after that date ?

Thank you for your assistance.

Dig


Feb 21 '06 #8
<di****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Thanks for the prompt reply. Changing the "<" To ">" will show vendors
that have had activity after that date. I need to see vendors that have
NOT had activity AFTER the date.

To put it another way, I need to see vendors that were used in 2001 (or
earlier), but have not been used since 2001.


I'm sorry but PCDS has no interest in your problem, only in his advertising.
Should you be interested there is more information here:
http://home.tiscali.nl/arracom/whoissteve.html

Regards,
Keith.
Feb 22 '06 #9

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

Similar topics

0
by: prabu | last post by:
Hello All, I am using Fsh,it has Python Dependecy.It uses several moduels from Python.The problem is"Select" module in missing in the list of modules available in python.So I can't import it.But...
0
by: Mike Chirico | last post by:
Hopefully this will help someone... Helpful Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Last Updated: Fri Apr 16 11:47:34 EDT 2004 The latest version of this...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
3
by: % =joe % | last post by:
I cannot get this code to work. Very simple...I have three list menus. I want to do a check before the form submits to make sure that the value of the 3 fields is equal to 12. Here's my...
5
by: Alicia | last post by:
Hello everyone based on the data, I created a union query which produces this. SELECT ,,, 0 As ClosedCount FROM UNION SELECT ,, 0 AS OpenedCount, FROM ORDER BY , ;
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
0
by: butterflyTee | last post by:
USING:ORACLE 9i For each of the following tasks, determine (a) the SQL statement needed to perform the stated task using the traditional approach and (b) the SQL statement needed to perform the...
0
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
1
by: upstart | last post by:
Hi everyone…this is a tough one. You guys have been such a help before, hopefully you can point me in the right direction now. I have a Report I am working on that uses a stored procedure to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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,...

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.