What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Another SQL Question

Another SQL Question
Author: Message:
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
37 / Male / Flag
Joined: Jul 2003
O.P. Another SQL Question
Well this is kind of a follow-on from my other thread: Number Range Query  but it's a different problem now.

I am using the following SQL query:   
code:
SELECT * M1PNON IN (SELECT M1ON FROM M1P WHERE M1PNON LIKE '573.%')
Firstly it finds the records where M1PNON has the order number of 573 and returns a list of the matching M1ON numbers.
Then it finds all the records that have their M1PNON field as one of the list just retireved.

This is working fine, but I have just found out that I need to do it another level deep as well, but I'm confused as to how.  Anyone have any pointers?

I havent explained it very well, I'll post some sample data:

code:
M1P            -            M1PNON


1            -            573
2            -            573
3            -            1
4            -            1
5            -            2
6            -            5
7            -            5

records 1 and 2 are top level parents.

3 and 4 are child records of record 1 and 5 is a child of number 2.

The query i have above can currently retireve both the parents and the first children, but it won't return a childs child, such as 6 and 7 which are children of record 5.

So what do I need to add to the query to also make it retrieve the third level?  Is it another IN statement?  If so where exactly?


Thanks for any help   :)
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
03-09-2006 05:21 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Another SQL Question - by Dempsey on 03-09-2006 at 05:21 PM
RE: Another SQL Question - by Adeptus on 03-09-2006 at 05:46 PM
RE: Another SQL Question - by Dempsey on 03-09-2006 at 05:48 PM
RE: Another SQL Question - by Adeptus on 03-09-2006 at 06:31 PM
RE: Another SQL Question - by Dempsey on 03-10-2006 at 09:14 AM
RE: Another SQL Question - by Adeptus on 03-10-2006 at 03:00 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On