Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Need help with SQL

Thread Tools
 
Old Oct 19, 2003 | 08:14 AM
  #1  
X Factor's Avatar
Thread Starter
Registered User
 
Joined: Oct 2003
Posts: 59
Likes: 0
From: 703
Default Need help with SQL

Im doing an assignment for my database class and the examples that we are given are in Oracle, but we are told to do the problems in MS Access. There are some functions that I do not know the equivalent of in Access. If you guys could help me out I would greatly appreciate it. The functions are "NOT IN" and "UNIQUE"

30) FIGURE P5.30 The Customer Balance Characteristics for Customers Who
Did Not Make Purchases During the Invoice Period


The command line is shown on the screen, just above its output, i.e.,

SELECT CUS_CODE, CUS_BALANCE
FROM CUSTOMER
WHERE CUS_CODE NOT IN (SELECT UNIQUE CUS_CODE FROM INVOICE);


31) Now find the customer balance summary for all customers who have not made purchases during the current invoicing period. The results are shown in Figure P5.31.

FIGURE P5.31 A Summary of Customer Balance Characteristics for Customers Who Did Not Make Purchases During the Current Invoice Period

The required SQL command is shown on the screen, just above its output, i.e.,

SELECT SUM(CUS_BALANCE), MIN(CUS_BALANCE), MAX(CUS_BALANCE),
AVG(CUS_BALANCE)
FROM CUSTOMER
WHERE CUS_CODE NOT IN
(SELECT UNIQUE CUS_CODE FROM INVOICE);
Reply
Old Oct 19, 2003 | 08:16 AM
  #2  
fantaS2K's Avatar
Registered User
 
Joined: Aug 2003
Posts: 1,369
Likes: 0
From: Charlotte
Default

Reply
Old Oct 19, 2003 | 08:19 AM
  #3  
fantaS2K's Avatar
Registered User
 
Joined: Aug 2003
Posts: 1,369
Likes: 0
From: Charlotte
Default

Thanks bro, I needed this
Reply
Old Oct 19, 2003 | 08:22 AM
  #4  
fantaS2K's Avatar
Registered User
 
Joined: Aug 2003
Posts: 1,369
Likes: 0
From: Charlotte
Default

Try distinct for unique
Reply
Old Oct 19, 2003 | 08:31 AM
  #5  
X Factor's Avatar
Thread Starter
Registered User
 
Joined: Oct 2003
Posts: 59
Likes: 0
From: 703
Default

cool that worked
Reply
Old Oct 19, 2003 | 11:01 AM
  #6  
The Unabageler's Avatar
Former Moderator
 
Joined: Oct 2000
Posts: 20,448
Likes: 0
From: internet
Default

NOT IN can be replicated by using a join.
Reply
Old Oct 19, 2003 | 11:05 AM
  #7  
The Unabageler's Avatar
Former Moderator
 
Joined: Oct 2000
Posts: 20,448
Likes: 0
From: internet
Default

SELECT CUSTOMER.CUS_CODE, CUSTOMER.CUS_BALANCE FROM CUSTOMER JOIN INVOICE WHERE DISTINCT INVOICE.CUS_CODE != CUSTOMER.CUS_CODE;
Reply
Old Oct 19, 2003 | 11:06 AM
  #8  
The Unabageler's Avatar
Former Moderator
 
Joined: Oct 2000
Posts: 20,448
Likes: 0
From: internet
Default

now, since i prorate by the hour, that's $60. you can use paypal, josh@3io.com
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
X Factor
Off-topic Talk
1
Nov 29, 2004 11:45 PM
AP1Sean
Off-topic Talk
0
Jun 29, 2004 01:45 PM
mav
Off-topic Talk
3
Nov 10, 2003 11:36 AM
wantone
Off-topic Talk
0
Mar 18, 2003 12:49 PM




All times are GMT -8. The time now is 02:17 PM.