Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 08-01-2010, 01:06 PM loop or chain query?
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
hello

i've got a table on my website which contains member and groupids along with a privilege on or off field. what i need to do is find all of the groups which a member belongs to and has privilege enabled in.

this is very easy to do, but what if a member could be a group? for example.

m1 is in g1, and g1 is a member of g2. because the memberid of g1 is not the member id of the currently logged in member, this query becomes rather difficult to fathom.

can this be acheived in mysql? i know that i could do something like this -

select m2.gid from members m1 left join members m2 on m1.gid=m2.uid where m1.uid=$myUserId

the problem with above is that it only works on 1 descedant, but my members could be 4th or 5th generation derived from the target group.

can anybody point me in the direction of some helpful documentation regarding this?

thank you

mark
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-07-2010, 12:56 AM Re: loop or chain query?
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
I know you can do recursive queries in MS SQL with CTE's but in mysql, I think it is much more of a challenge.

Here is a guide that might help:
http://explainextended.com/2009/03/1...ries-in-mysql/
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 08-16-2010, 05:58 AM Re: loop or chain query?
Average Talker

Posts: 19
Name: Hiren Modi
Trades: 0
Loop query and chain Query is too much different. in loop we can check condition if it is true then condition check again and in chain it get new value in condition.
hirenmodi is offline
Reply With Quote
View Public Profile Visit hirenmodi's homepage!
 
Old 08-18-2010, 12:28 AM Re: loop or chain query?
Average Talker

Posts: 18
Name: Samual
Trades: 0
both the actions are different.........they works differently...
shiam is offline
Reply With Quote
View Public Profile
 
Old 08-26-2010, 05:39 AM Re: loop or chain query?
Banned

Posts: 19
Name: Hanna
Trades: 0
The LOOP statement is a special type of statement, because it has no terminating condition clause.
hanna_depp is offline
Reply With Quote
View Public Profile Visit hanna_depp's homepage!
 
Reply     « Reply to loop or chain query?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60178 seconds with 12 queries