473,785 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1272
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******@pcdata sheet.com
<di****@yahoo.c om> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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******** ********@newsre ad1.news.atl.ea rthlink.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.c om> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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.c om> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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
1007
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 the library file needed for select module ,select.sl is there in the python(I guess).If anyone has come across such problem before,if do help me.Help me in knowing how to import the select module (from python). With Advance Thanks,
0
1496
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 document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download Format is better on the above link. I'm looking for suggestions and
9
3137
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 SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
28
3307
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 make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
3
5019
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 code... <script language="javascript"> <!-- function addListValues() {
5
1922
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
2196
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 another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
0
2920
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 stated task the JOIN keyword. 1. A list that displays the title of each book & the name and phone number of the person at the publisher's office whom you would need to contact to record each book.
0
2453
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 the whole. I really need MySQL wizz to give me a hand (and maybe refer me to books to get me to the wizz level myself). First off, english is a second language to me and sometimes my sentences might be a little awkward. Please forgive me. Mon...
1
1755
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 pass along all off the parameters to the reporting generator (Crystal Reports) and I was currently trying to optimize it for my users, but am not sure of the best way to go about doing it. It took me forever to get it to work as it is now. I...
0
9645
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
9480
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
10324
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
10147
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...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.