Jump to content

MySQL Query Improvement


Viry

Recommended Posts

Hi,

 

Could someone please help me improve this query and try to cut down on the repeated "`id` != '*'" parts.

 

SELECT `id`, `user`, `usertwo`, `time` FROM `feeds` WHERE `user` = '1' AND `id` != '38000' AND `id` != '38007' OR `usertwo` = '1' AND `id` != '38000' AND `id` != '38007' OR `usertwo` IN ( SELECT `frdid` FROM `friends` WHERE `userid` = '1' ) AND `id` != '38000' AND `id` != '38007' OR `usertwo` IN ( SELECT `fb_uid` FROM `service_friends` WHERE `userid` = '1' ) AND `id` != '38000' AND `id` != '38007' ORDER BY `time` DESC LIMIT 1

Link to comment
https://forums.phpfreaks.com/topic/156111-mysql-query-improvement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.