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
mysql helpppp on join
Old 01-21-2008, 12:33 PM mysql helpppp on join
Junior Talker

Posts: 4
Name: Soheil
Trades: 0
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
 
 
Register now for full access!
Old 01-29-2008, 09:16 AM Re: mysql helpppp on join
Skilled Talker

Posts: 94
Trades: 0
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
Please login or register to view this content. Registration is FREE
! See a live
Please login or register to view this content. Registration is FREE
ChadR is offline
Reply With Quote
View Public Profile
 
Old 01-30-2008, 03:29 AM Re: mysql helpppp on join
Junior Talker

Posts: 4
Name: Soheil
Trades: 0
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, 03:58 AM Re: mysql helpppp on join
Average Talker

Posts: 17
Trades: 0
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?
__________________

Please login or register to view this content. Registration is FREE
- 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 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.51579 seconds with 12 queries