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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:51:36+00:00 2026-05-25T11:51:36+00:00

I did a very simple query yesterday but this morning I couldn’t remember how

  • 0

I did a very simple query yesterday but this morning I couldn’t remember how I did it, and whatever I tried doesn’t work.

I want to do a simple SELECT COUNT(*) and then update table TEST. We want how many values from column start are (table1) are between the values in column txStart and column txEnd (from table TEST).

The SELECT COUNT(*) alone works well.

mysql> SELECT COUNT(*) FROM table1, TEST where table1.start BETWEEN TEST.txStart AND TEST.txEnd;
+----------+
| COUNT(*) |
+----------+
|    95149 |
+----------+
1 row in set (0.03 sec)    

The UPDATE never happened.

 mysql> UPDATE TEST 
       SET rdc_1ips =  
       SELECT COUNT(*) FROM table1, TEST WHERE table1.start between TEST.txStart AND TEST.txEnd;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘SELECT COUNT(*) FROM table1, TEST WHERE table1.start between TEST.txStart A’ at line 1

Here is a preview of the table1 and table TEST

mysql> SELECT * from table1 limit 2;
+----+--------+------+---------+---------+------+-------+
| id | strand | chr  | start   | end     | name | name2 |
+----+--------+------+---------+---------+------+-------+
|  1 | -      | 1    | 2999997 | 3000096 | NULL | NULL  |
|  2 | +      | 1    | 2999998 | 3000097 | NULL | NULL  |
+----+--------+------+---------+---------+------+-------+


mysql> SELECT * FROM TEST;
+------+-----------+--------------+-------+---------+---------+----------+
| chr  | pos_start | name         | name2 | txStart | txEnd   | rdc_1ips |
+------+-----------+--------------+-------+---------+---------+----------+
| 1    |   3204575 | NM_001011874 | Xkr4  | 3204562 | 3661579 |        0 |
+------+-----------+--------------+-------+---------+---------+----------+
  • 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-25T11:51:37+00:00Added an answer on May 25, 2026 at 11:51 am

    Put the sub-select in brackets.
    Additionally I would give the inner “test” table an alias (just to be sure)

    SET rdc_1ips = 
       (SELECT COUNT(*) FROM table1, TEST t2 
        WHERE table1.start between t2.txStart AND t2.txEnd)
    

    But I’m not sure if this will work even if the syntax is correct. MySQL has some obnoxious limitiations when it comes to selecting from the same table that you want to update.

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

Sidebar

Related Questions

What I'm trying to do seems very simple, but I did not yet find
I'm trying to do a very simple sql query like this, to a propel
This seems very simple, but I wonder how to turn off viper-mode once I
This seems very foolish mistake, I just did a git stash pop on a
This one very simple thing I can't find the right technique. What I want
Very simple problem...but weird results. Im just trying to fill a drop down list
Hi I don't understand this simple SQL query with JOIN . I want to
I've created a very simple test Document based application with Core Data. I did
Did you ever have the following situation: you need to store information, but a
Did anyone tried to customize the window in which the quicktime is playing video?

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.