Reply
mysql helpppp on join
Old 01-21-2008, 11:33 AM mysql helpppp on join
Junior Talker

Posts: 4
Name: Soheil
Hello everyone....

im have a problem with my message system in my webstie between users..

i got this error:
The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay

i use the following query to show their messages in inbox folder..


SELECT *
FROM TblMsgs, TblUsers

WHERE (
(
(TblMsgs.user_id_from = $loginID
AND TblMsgs.user_id_to = TblUsers.id)
OR
(TblMsgs.user_id_to = $loginID
AND TblMsgs.user_id_from = TblUsers.id)
)

ORDER BY time DESC


lets say user A is logged in....

it is 2 cases :
1- when user A send user B a message
then TblMsgs.user_id_from is ID of user A

2- when user B send user A a message
then TblMsgs.user_id_to is ID of user A


in both cases we need to have information of user B to show it beside message(in user A's inbox)... so
in first case : TblMsgs.user_id_to = TblUsers.id
and in second case: TblMsgs.user_id_from = TblUsers.id


anywayz this was workin befor on some other server....

any idea how i can have same information with another query?
s0h31l is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 01-29-2008, 08:16 AM Re: mysql helpppp on join
Skilled Talker

Posts: 88
Do you really need to use the dread evil *? The settings in your MySQL have changed.

http://dev.mysql.com/doc/refman/5.0/en/set-option.html

I would recommending re-writing this MySQL statement.
__________________
Sell Templates? Try our Template Monster WebAPI absolutely free! See a live Template Shop Demo
ChadR is offline
Reply With Quote
View Public Profile
 
Old 01-30-2008, 02:29 AM Re: mysql helpppp on join
Junior Talker

Posts: 4
Name: Soheil
thx for ur replyin

well i put "*" only here to make it simple to understand for ppl who see it here....

i beliave there is something wrong becasue in each case it want to make join ON different id... becasue this one down here works well... but imagine u sent 10 msg to different ppl and in inbox folder (when they got reply back) it shows ur picture beside all msg u sent...

SELECT *
FROM TblMsgs, TblUsers

WHERE (

TblMsgs.user_id_from = $loginID

OR
TblMsgs.user_id_to = $loginID
)



AND TblMsgs.user_id_from = TblUsers.id)

ORDER BY time DESC
s0h31l is offline
Reply With Quote
View Public Profile
 
Old 01-31-2008, 02:58 AM Re: mysql helpppp on join
Average Talker

Posts: 17
What are the row counts from these tables? It seems like you might have some bad logic on the criteria. Can you post the table structures?
__________________
DrivingForums.net - Defensive driving, fuel saving, discussion, debate, and more.
Crankshaft is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to mysql helpppp on join
 

Thread Tools

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
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.13186 seconds with 13 queries