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

  • SEARCH
  • Home
  • 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 8839953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:21:16+00:00 2026-06-14T10:21:16+00:00

I have a barebones search system that just got more complicated and there are

  • 0

I have a barebones search system that just got more complicated and there are many weird issues going on with it. How can I rewrite this search query to be more accurate and efficient

The tbl_notes table only has the id of the course but to add it to the search I used a inner query to check it too. There are alot of issues with this and I’m not too strong in mysql any help would be appreciated.

TBL_NOTES:

[id][user_id][note_title][note_title][topic][course][note]

TBL_COURSES:

  [id][user_id][course_name]

   SELECT * FROM `tbl_notes` 
    WHERE `active` = '0' 
    AND `valid_note` = '0' 
    AND `user_id` = '33' 
    AND `note` LIKE '%biology%' 
    OR `topic` LIKE '%biology%' 
    OR `note_title` LIKE '%biology%' 
    OR `course` IN (SELECT `id` FROM tbl_courses WHERE `course_name` LIKE '%biology%' AND user_id = '33') 
    ORDER BY id DESC LIMIT 0, 6

Thanks

  • 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-14T10:21:17+00:00Added an answer on June 14, 2026 at 10:21 am

    I would write it like this:

    SELECT
      DISTINCT n.*
    FROM
      `tbl_notes` n left join `tbl_courses` c
      on n.course = c.id
    WHERE
      n.`user_id` = '33'
      AND n.`active` = '0' 
      AND n.`valid_note` = '0'
      AND (n.`note` LIKE '%biology%' 
           OR n.`topic` LIKE '%biology%' 
           OR n.`note_title` LIKE '%biology%' 
           OR c.`course_name` LIKE '%biology%') 
    ORDER BY n.id DESC LIMIT 0, 6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that will involve heavy automation of complicated web pages. I
I am trying to create a very barebones fileserver that does nothing more than
I have small image hosting and I realized there many duplicate content. I want
I have some abstract base class that defines abstract functions. For example (barebones), abstract
I have a barebones index.html, Anddroid Phonegap project in Eclipse that will not execute
I have a bare-bones install of jenkins on my Ubuntu server that I installed
I have an interesting situation, well it's probably not that unique at all, but
I'm looking for a barebones javascript example that demonstrates how the javascript plugin architecture
Here's a simple, barebones example of how the code that I'm trying to do
Currently, I have a barebones implementation of the quicksort algorithm to sort some randomly

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.