473,569 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

negate RESULT SET, all inactive client

I' d like to list all inactive clients.
Inactive client is a client who hasn't had invoice for 2 months.

I use INNER JOIN to join invoice view (vwDok4FSFZGrid ) and clients
addresses table (adr_Nazwa). I skip empty values (adr_Ewid.adr_N azwa !
=''). I select only invoices with date after the interesting date.

So now I can list all active clients but i can't negate this result
set to get all inactive clients:

SELECT dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna, adr_Adres,adr_M iejscowosc,adr_ NIP, dok_DataWyst
FROM vwDok4FSFZGrid
INNER JOIN adr__Ewid
ON vwDok4FSFZGrid. dok_PlatnikId=a dr__Ewid.adr_Id Obiektu
WHERE
adr__Ewid.adr_N azwa !=''
AND
(dok_DataWyst >= convert(datetim e,'10/03/2007'))
GROUP BY dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna, adr_Adres,adr_M iejscowosc,adr_ NIP, dok_DataWyst

Is there any way to negate this set?

1. Sorry for my English
2. I would appreciate any help
:)

Oct 3 '07 #1
1 2401
Mike (da************ ***********@gma il.com) writes:
I' d like to list all inactive clients.
Inactive client is a client who hasn't had invoice for 2 months.

I use INNER JOIN to join invoice view (vwDok4FSFZGrid ) and clients
addresses table (adr_Nazwa). I skip empty values (adr_Ewid.adr_N azwa !
=''). I select only invoices with date after the interesting date.

So now I can list all active clients but i can't negate this result
set to get all inactive clients:

SELECT dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna, adr_Adres,adr_M iejscowosc,adr_ NIP, dok_DataWyst
FROM vwDok4FSFZGrid
INNER JOIN adr__Ewid
ON vwDok4FSFZGrid. dok_PlatnikId=a dr__Ewid.adr_Id Obiektu
WHERE
adr__Ewid.adr_N azwa !=''
AND
(dok_DataWyst >= convert(datetim e,'10/03/2007'))
GROUP BY dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna, adr_Adres,adr_M iejscowosc,adr_ NIP, dok_DataWyst

Is there any way to negate this set?
A complete guess:

SELECT adr_Nazwa, adr_NazwaPelna, adr_Adres,adr_M iejscowosc,adr_ NIP
FROM adr__Ewid a
WHERE a.adr_Nazwa <''
AND NOT EXISTS (SELECT *
FROM vwDok4FSFZGrid v
WHERE v.dok_PlatnikId = a.adr_IdObiektu
AND v.dok_DataWyst >= '20070310')

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 3 '07 #2

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

Similar topics

6
1770
by: Bart Nessux | last post by:
Hello, Auditors want us to log out a user if the computer they are logged onto has been unused/inactive for a set period of time. It's trivial to logout the user, but we're having trouble telling if the system is indeed inactive. If we could learn that information, then we'd need to measure how long it has been like this so we can all the...
0
6348
by: Subhodini Fernandes | last post by:
We have a couple of Oracle (8.x and 9.x) install on Sun Solaris platforms. On most of the servers we have a very strange problem 1. When Oracle is started in the morning, memory usage is very low. 2. During the course of the day the memory the memory increases upto 50-60GB 3. When I check the active connections in Oracle (v$session table),...
0
990
by: Maruko | last post by:
I can see in much software as photoshop all its toolbar property and others child window are active if the main is active and are inactive if the main is not. How can i fake the windows message to avoid to draw the titlebar of childs inactive when i click on the main? Thanks.
1
1830
by: JKM | last post by:
I'm a newbie to VB.NET and ASP.NET (as you'll see by my code). However, I'm not able to get a simple process to work. I'm trying to retrieve a record and then check to see if the 'accountstat' column of the DB is set to 'inactive'. I can't, however, get it to compare correctly. Here's the code Sub Sign_In(s As Object, e As EventArgs If...
6
9855
by: wij | last post by:
Hi: What is the protable way to negate an arithmetic integer? template<typename T> T negate(T t) { return -t; // <-- problem } On my Intel machines, taking negation like the above is not
1
1411
by: shilpi.rustagi | last post by:
hi again.. i have a basic regular expression problem. we can negate a single charecter like this . but i want to negate a whole group e.g (<\tag>) hw can i do that can anyone help on it. thanks
2
2950
by: jzhang918 | last post by:
Hi, Should f(INT_MIN) return 0 according to the C99 for the following function f (), or its result is undefined? int f(int i) { i = i 0 ? i : -i; if (i<0) return 0;
2
1420
by: Ronald S. Cook | last post by:
At first, it's easy to say (have a policy) that we'll hard-code for statuscode='ACT' (or maybe instead statuscode <'INA') but I think that pigeonholes us and would cause limitations. Example: We want to develop an Employee search screen. Obviously, we don't want inactive records to be displayed. The tables look like this: Employee
8
18259
by: Summercool | last post by:
somebody who is a regular expression guru... how do you negate a word and grep for all words that is tire but not snow tire or
0
7703
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...
0
7618
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...
0
7926
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. ...
1
7678
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...
0
7982
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...
0
6286
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...
1
5514
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...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
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...

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.