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 8554027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:47:17+00:00 2026-06-11T14:47:17+00:00

I have a LONGTEXT column that I use to store paragraphs of text. Let’s

  • 0

I have a LONGTEXT column that I use to store paragraphs of text. Let’s say that within these paragraphs there is something like:

Text text text text
COUNT: 75  text text
 text text text text
 text text text text

Would it be possible to do a comparative query the small string “COUNT: 75” out of all that text?

My first thought was something like

SELECT * FROM `books`
WHERE `paragraphs` LIKE '%COUNT: >0%'

Is this even possible?

  • 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-11T14:47:18+00:00Added an answer on June 11, 2026 at 2:47 pm

    Your SELECT will only find rows where the text contains exaclty the bit between the wildcard characters: you can’t combine a LIKE with comparative logic like that.

    What you can do, though, is to strip out the relevant sections of text using a regular expression and then analyse that.

    Bear in mind, though, that combining

    • large amounts of text
    • textual content logic
    • regex

    all at once will not provide the best performance! I would suggest the following:

    1. use a trigger to strip out a subsection of text so that you have
      something manageable (i.e. 50 characters or so) to work with,
      inserting this subtext into a separate table
    2. use MySql regex or fulltext functions to analyse your COUNTs

    So your trigger would have something like:

    select 
    ltrim(rtrim(substring(paragraphs, instr(paragraphs, 'count:') + 6, 10)))
    from books 
    where instr(paragraphs, 'count:') > 0
    

    which would get you the next 10 characters after 'count:', trimmed of whitespace. you could then further refine that by e.g.

    select substring(text_snippet, 1, instr(text_snippet, ' ')) as count_value
    from
    (
        select 
        ltrim(rtrim(substring(paragraphs, instr(paragraphs, 'count:') + 6, 10))) 
              as text_snippet
        from books 
        where instr(paragraphs, 'count:') > 0
    ) x
    where isnumeric(substring(text_snippet, 1, instr(text_snippet, ' '))) = 1
    

    to get rows where a numerical value follows the COUNT bit.

    You can then extract numerical values next to COUNT, saving them as numbers in a separate table, and then use a JOIN like this:

    select b.*
    from books b inner join books_count_values v
    on b.id = v.books_id
    where v.count_value > 0
    

    See here

    http://dev.mysql.com/doc/refman/5.1/en/string-functions.html

    for the functions at your disposal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple lines of text entered into a single MySQL longtext cell that
Let's say I have the following ListView: <ListView ScrollViewer.VerticalScrollBarVisibility=Auto> <ListView.View> <GridView> <GridViewColumn Header=Something DisplayMemberBinding={Binding
I have a column saved as LONGTEXT on mysql. This text saves rich text.
I Have a program written in VB6 that reads a long text file and
i have a datagrid that displays long text on couple columns. I have set
I have am trying to implement something along the lines of Slickgrid, column with
Is it possible to store a MySQL AES_ENCRYPT into a LONGTEXT column? I know
I have a JTable where one column occasionally has a fair amount of text
How do I fit long text into a fixed width column where I have
I have a table that contains content (like blog posts, so fairly long text)

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.