If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Brain Fart on self joins

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-27-07, 17:40
MonteC818 MonteC818 is offline
Registered User
 
Join Date: Jun 2007
Posts: 4
Brain Fart on self joins

I have a table called custrate using the following design and records.
Code:
custrate
custid          rateid
1                          120
1                          200
2                          130
2                          300
3                          121
3                          200
4                          131
4                          300
5                          122
5                          200
6                          132
6                          300 
7                          120
8                          130
9                          121
10                         131
Essentially custrate records should come in pairs, but the database I'm working on is messed up ([rateid 120-129 goes with rateid 200] AND [130-139 goes with 300]). What sql statement can I run inorder to select the custid of the records that are missing there corresponding X00 rate? I hope this is clear.

The custid's that should be returned are 7,8,9, and 10.

Thanks in Advance
Reply With Quote
  #2 (permalink)  
Old 06-27-07, 19:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
okay, look, here's the deal

you've asked two other very similar questions in the SQL Server forum

Complex Join, I think.
Probably an easy JOIN. I but I don't know

both of which i answered, but got no acknowledgement from you

now this thread, in the mysql forum -- WTF?

i don't really want to keep helping you if your problem keeps sliding around like this

you should've asked the real question, in the appropriate forum, in the first place
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 06-27-07, 21:16
MonteC818 MonteC818 is offline
Registered User
 
Join Date: Jun 2007
Posts: 4
I don't mean for it to appear like I'm trying to get the answer from some one else. The post in the MSSQL forum was for a MSSQL database which I use for work. I'm not at work now and I only has access to mySql database. So I created a database similar to the database from work to see if I could find the result I'm looking for here at home. I don't know wether the other statement will work or not cause I haven't run it on a MSSQL database. However it definitely did not work with my MySql server. I do appreciate you response and when I get a change to see if it work I'll provide feed back to it. Thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On