473,513 Members | 2,601 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_Nazwa !
=''). 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_Miejscowosc,adr_NIP, dok_DataWyst
FROM vwDok4FSFZGrid
INNER JOIN adr__Ewid
ON vwDok4FSFZGrid.dok_PlatnikId=adr__Ewid.adr_IdObiek tu
WHERE
adr__Ewid.adr_Nazwa !=''
AND
(dok_DataWyst >= convert(datetime,'10/03/2007'))
GROUP BY dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna,adr_Adres,adr_Miejscowosc,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 2394
Mike (da***********************@gmail.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_Nazwa !
=''). 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_Miejscowosc,adr_NIP, dok_DataWyst
FROM vwDok4FSFZGrid
INNER JOIN adr__Ewid
ON vwDok4FSFZGrid.dok_PlatnikId=adr__Ewid.adr_IdObiek tu
WHERE
adr__Ewid.adr_Nazwa !=''
AND
(dok_DataWyst >= convert(datetime,'10/03/2007'))
GROUP BY dok_PlatnikId, adr_Nazwa,
adr_NazwaPelna,adr_Adres,adr_Miejscowosc,adr_NIP, dok_DataWyst

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

SELECT adr_Nazwa, adr_NazwaPelna,adr_Adres,adr_Miejscowosc,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****@sommarskog.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...
0
6344
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...
0
986
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...
1
1827
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'...
6
9849
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...
1
1404
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. ...
2
2943
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
1413
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...
8
18253
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
7259
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
7380
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,...
0
7535
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...
1
7098
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...
0
7523
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...
1
5085
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...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
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 ...
0
455
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...

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.