Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 15th, 2003, 01:53 AM
coume coume is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: France / Finland
Posts: 13 coume User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy [Ms SQL] Guru needed... Since one week, I'm on that QUERY but ... :(

Hello,

I am posting it here, as I tried on the french developer forum that I usually use but after dozen of replies, noone find a working solution!
I'm getting mad with this problem! I'm spending hours on it.
It MUST have a solution, but... I don't know if my brain can figure it out.
Perhaps one of you have already done it or will see on the first look the QUERY...

I'm explaining the problem:
I have 2 tables:
PDM_USER_2
Code:
MAINKEY   |    Name     | .....
************************
   1       |    Tux        |  ....
   2       |    Bill         |  ....
   3       |   Jeff         |  ....
  ...       |   ....     |  ....
  546    |    JacK       |  ....
  547    |    Fred       |  ....
  548    |     Ludo     |  ....


the second one:
PDM_USER_DOSE_2
Code:
MAINKEY   |    UserID   |   PeriodID  | .....
************************
   1       |       2   |     2          | ....
   2       |     362    |     5          | ....
   3       |    125     |     12        | ....
  ...      |   ....      |   ..       | ....
  2546     |    425     |       9          | ....
  2547     |    37       |     12        | ....
  2548     |     13      |     11        | ....



The AIM of THE QUERY:
To get all the users identified by PDM_USER_2.MAINKEY that do not have a record in the PDM_USER_DOSE_2 for a specific period (i.e: 12)

For the previous example, it shoul give all the ids from 1 to 548
less 125 and 37.

Any help, tips, advice or whatever will be welcome...

Thanks
Ludo, Desesperate...

Last edited by coume : August 15th, 2003 at 03:37 AM.

Reply With Quote
  #2  
Old August 15th, 2003, 03:32 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,762 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 4 h 29 m 45 sec
Reputation Power: 37
Code:
select PDM_USER_2.mainkey
from PDM_USER_2 left join PDM_USER_DOSE_2 
on PDM_USER_2.mainkey = PDM_USER_DOSE_2.userid
and periodid = 12
where PDM_USER_DOSE_2.userid is null

Reply With Quote
  #3  
Old August 15th, 2003, 03:52 AM
coume coume is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: France / Finland
Posts: 13 coume User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
GOSH!

That's working!!!!!!!!!!!!!!!!!!!!!!
I don't know how I can thank you! But I really really appreciate!
I should have posted here before!

Thank you very much!

swampBoogie You are a KING!!!!

Cheers,
Ludo

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > [MYSQL] Guru needed... Since one week, I'm on that QUERY but ... :(


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway