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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:42:27+00:00 2026-05-30T16:42:27+00:00

I have this query but apparently it can loop and crash the server. SELECT

  • 0

I have this query but apparently it can loop and crash the server.

SELECT neveras.Panel, contactos.Email FROM neveras, contactos
WHERE neveras.Alarma = 1 And  Estado <> 1
And contactos.Sensor 
LIKE CONCAT('%,',(Select Usuario FROM neveras where Alarma = 1),',%')

Table neveras:

Id|Panel|Usuario|Alarma|Estado
 1  uno     1       1     2
 2  dos     1       2     1
 3  tres    2       2     1
 4  cuatro  2       2     1
 5  cinco   3       2     1

Table Contactos:

Id  |Email   |Nombre    |Sensor
 1  uno@uno   nombre1     1,3,5   
 2  dos@dos   nombre2     2,4    

This table has this structure to avoid repeating values

I appreciate your help.

  • 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-05-30T16:42:28+00:00Added an answer on May 30, 2026 at 4:42 pm

    This is a bit of a guess as I am not 100% sure what you are trying to achieve, but give this a try –

    SELECT neveras.Panel, contactos.Email 
    FROM neveras
    INNER JOIN contactos
        ON FIND_IN_SET(neveras.Usuario, contactos.Sensor)
    WHERE neveras.Alarma = 1
    AND neveras.Estado <> 1
    

    As Mosty pointed out it would definitely help if you posted an example of what you expect in the result.

    Further to that, you should move the multiple values in your Sensor field to a many-to-many table (contactos_id, sensor_id). There is no way for the optimizer to do anything clever with your comma sparated list so any filtering or joining on that field will be very inefficient.

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

Sidebar

Related Questions

I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I have this query: SELECT page.id, revision.title, revision.number FROM page INNER JOIN revision ON
I have this query working but it is not returning back exactly what I
I have this query. It matches anything which has South in its name. But
Right now I have this SQL query which is valid but always times out:
I have a feeling I am completely borking this MySQL query but I'll ask
I have this query in LINQ to Entities. var query = (from s in
I have this query this.FixturePartidoPuntaje.Load(); var partidos = from q in this.FixturePartidoPuntaje where (
I have a query like this: SELECT jobs.*, ( CASE WHEN lead_informations.state IS NOT
I have a simple SQL query, SELECT * FROM phones WHERE manu='$manuf' AND price

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.