Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007

    Unanswered: Brain Fart on self joins

    I have a table called custrate using the following design and records.
    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

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    okay, look, here's the deal

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

    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 | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2007
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts