Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:55:47+00:00 2026-06-10T03:55:47+00:00

I have two tables, a message table and a log table. I want to

  • 0

I have two tables, a message table and a log table.

I want to return all rows in the message table that have been logged to a user and whose message # is greater than a passed parameter.

What I have is:

SELECT * FROM message WHERE id IN ( SELECT msg_id AS id FROM msg_log WHERE user_num='1000' AND msg_id >='1660192')

This query returns nothing, produces no errors, it simply times out… It doesn’t matter if it run from a PHP script or phpMyAdmin. In fact, if run from phpMyAdmin it doesn’t even show the query is running, but it doesn’t allow you to execute another query.

If I break out the IN select

SELECT msg_id AS id FROM msg_log WHERE user_num='1000' AND msg_id >='1660192')

This returns 0 records (as it should)

How do I fix this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:55:48+00:00Added an answer on June 10, 2026 at 3:55 am

    Try this:

    SELECT message.* FROM message 
    INNER JOIN msg_log 
        ON message.id = msg_log.msg_id
       AND msg_log.user_num = '1000' 
       AND msg_logmsg_id >= '1660192'
    

    The INNER JOIN syntax should be faster than IN clause.
    Naturally you could speed query up having

    • message.id as INDEX or PRIMARY_KEY
    • msg_log.id as INDEX and probably related to message.id with a FOREIGN_KEY
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables users registered_members I want to confirm values from user table
I have two tables user table user_id | name | 1 | peter |
I have two tables, a user table and a application table: User id username
I have two tables: Table groupMessage is used for record group user Messages Table
I have two tables, like these: Table People: VARCHAR Name INTEGER Age Table Message
Let's say I have two tables: TABLE A MessageID | Message 1 | Hello
I have two tables and I want to have change event on one table.
hi i have two tables namely sms(Message,sms_index...columns) c_paid_bribe(c_addi_info,....) what i want to do is
I feel totally stupid. I'm rusty with my sql. I have two tables, Message
I have two tables: table a ida valuea 1 a 2 b 3 c

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.