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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:45:49+00:00 2026-06-07T22:45:49+00:00

This query should return 4 rows but returns 1 with the ID of 62983.

  • 0

This query should return 4 rows but returns 1 with the ID of 62983. Any reason why?

SELECT *
    FROM sims_user_role_maps surm
    JOIN sims_role sr ON surm.role_id = sr.id
    WHERE 
        surm.user_id = 118730
        AND sr.organization_id REGEXP 62978|62981|62982|62983

SP Call

call schools_remove_for_user('f155ec0e-b9ce-11e1-a1fa-001cc4565d26', '62966|62969|62983') 

SP

CREATE PROCEDURE `schools_remove_for_user`(
    user_id NVARCHAR(255),
    school_ids LONGTEXT
)
BEGIN

DECLARE sims_user_id INT DEFAULT NULL;

SELECT u.sims_id 
INTO sims_user_id 
FROM user u 
WHERE u.id = user_id;

SET SQL_SAFE_UPDATES = 0;

DELETE FROM sims_user_role_maps
WHERE 
        user_id = sims_user_id
    AND role_id IN (
                SELECT role_id 
                FROM(
                    SELECT surm.role_id 
                    FROM sims_user_role_maps surm
                    JOIN sims_role sr ON surm.role_id = sr.id
                    WHERE 
                            surm.user_id = sims_user_id
                        AND sr.organization_id REGEXP school_ids) 
                A);

END
  • 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-07T22:45:51+00:00Added an answer on June 7, 2026 at 10:45 pm

    The reason was the user_id in the delete statement. I added the table name as the prefix.

    DELETE FROM sims_user_role_maps
    WHERE 
            sims_user_role_maps.user_id = sims_user_id
        AND sims_user_role_maps.role_id IN (
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this query SELECT * FROM tblContracts LEFT JOIN tblPartys ON tblContracts.id = tblPartys.Contract_id INNER
This is example of the problem i am having. The query should return rows
This is example of the problem i am having. The query should return rows
I'm running Mysql 5.0.77 and I'm pretty sure this query should work? SELECT *
This query works fine for me: $query = SELECT p.topnode_id, p.param_key, p.param_value FROM tbl_params
I want to do this query: SELECT * FROM mail WHERE tag_draft = 0
The following query should return 180 rows (as it is the total number of
I am trying to write a SQL query that returns rows from a table
I have a query like this: select data_name into v_name from data_table where data_table.type
I've got a query that's supposed to return 2 rows. However, it returns 48

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.