How does MySQL update the fields value in the same table? test 1:  update tb_chapters t set t.order_id = (SELECT COUNT(*) AS c FROM tb_chapters t2 WHERE t.bid = t2.bid AND t.id > t2.id)   error:  1093 - You can't specify target table 't' for update in FROM clause     test 2:  update tb_chapters t set t.order_id = (SELECT t2.c FROM (SELECT COUNT(t1.id) AS c FROM tb_chapters t1 WHERE t1.bid = t.bid AND t1.id &lt; t.id) AS t2)   error: 1054 - Unknown column 't.bid' in 'where clause'     test 3:  update tb_chapters AS t JOIN (SELECT id, COUNT(id) AS c FROM tb_chapters t1 WHERE t1.bid = t.bid AND t1.id &lt; t.id) AS t2 USING(id) set t.order_id = t2.c   error: 1054 - Unknown column 't.bid' in 'where clause'
MySQL Error 1093 - Can't specify target table for update in FROM clause I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries:  SELECT *  FROM  story_category  WHERE category_id NOT IN (     SELECT DISTINCT category.id      FROM category INNER JOIN         story_category ON category_id=category.id);   I tried to delete them executing:  DELETE FROM story_category  WHERE category_id NOT IN (     SELECT DISTINCT category.id      FROM category        INNER JOIN story_category ON category_id=category.id);   But I get the next error:      #1093 - You can't specify target table 'story_category' for update in FROM clause    How can I overcome this?
What do you call someone who is supported? Synonym for a supportee (Which doesn't seem to be a word)?  I created products that retail and we sell them and give the proceeds to charities. Trying to figure out a single word to use as a page title for those that we support were we can list the charities (With their permission of course).  Thanks Sci-fi book about a male entering a competition that he wins and gets recruited by millitary How can I improve Ubuntu overall system performance? Something very odd is happening here.   I have a query that looks like this.  SELECT CAST(FT.DOP AS SMALLINT) FROM TRACKING_DATA WHERE date &gt; @mydate and identifier = 0000000000   When run as a raw query it returns data just fine.  When i place it in a stored procedure that alters the where clause it throws this error.  Msg 244, Level 16, State 2, Procedure myprocedure, Line 107 [Batch Start Line 2] The conversion of the varchar value '58629' overflowed an INT2 column. Use a larger integer column.   So here is the oddity. I go through all the possible data for that where clause with a query like this.  SELECT DISTINCT DOP FROM TRACKING_DATA where identifier = 000000000000   and  SELECT DISTINCT CAST(DOP AS smallint) FROM TRACKING_DATA where identifier = 000000000000   And this is what i get back.  17 12 9 19 8 14 6 16 11 13 7 10 0 18 5 15 4   Nowhere does it have anything remotely too large for a SMALLINT. So i thought, ok maybe its a non-printable ASCII character. But i can't find any.  I'm a little perplexed at the moment. It runs find as a raw query, explodes as a procedure and all possible data based on the where is valid. My only suspicion is that the query plan is doing something odd with filtering or maybe runs with different validation when run as a procedure. dimension of a subspace spanned by two subspaces If $M$ and $ N$ be the subspaces of a vector space $V$ then prove that  $(\dim M) + (\dim N) = (\dim M+N) + (\dim M \cap N)$. Why are vias placed this way on a PCB? I used to check complex commercial PCBs specially those of graphics cards to see how professional PCB designers do their layout and learn from their techniques.  When I checked the card shown below I noticed two things regarding the placement of vias:  (A higher resolution image is ).   The PCB is surrounded by stitching vias all around the edges. What's the role of all of these? I think they're connected to ground to act as a shield, if that's true, I can't understand technically how by this placement they achieve this shield? By looking closer to the mounting holes, I noticed they added vias all around the pad, why? Can I use my Windows 7 license in a dual-boot configuration? Possible Duplicate:          I've purchased a retail license of Windows 7 Ultimate for my machine at home.  I'm thinking of creating a dual-boot install:   64-bit install for work apps (need the RAM for virtual machines and RAMDisk) 32-bit install for entertainment apps (Media Centre, games, etc)   How does retail licensing work in such situations? Can I activate the same license on both installations?  Edit:  I would like to add that I want to have separate partitions for work and play. How does one [easily] calculate $\sum\limits_{n=1}^\infty\frac{\mathrm{pop}(n)}{n(n+1)}$, where $\mathrm{pop}(n)$ counts the number of bits '1' in the binary representation of $n$? Is there any trick to calculate the sum? From what I already have, it definitely converges. Possible Duplicate:          The  describes the expansion of the $n$th power of the sum $(a+b)$:  $$(a+b)^n = \sum_{k = 0}^n {n\choose k}a^kb^{n-k}$$  In calculus, there is a generalization of the product rule called , which describes the expansion of the $n$th derivative of the product of two functions $f$ and $g$:  $$(fg)^{(n)} = \sum_{k = 0}^n {n\choose k}f^{(k)}g^{(n-k)}$$  It's not difficult to prove using the product rule and induction, what I'm really trying understand here is why the formula is true. Is there a way to prove it using the binomial formula? How are these two formulas related? Is there a combinatorial proof for Leibniz's rule like there is for the ?   I understand this question is a bit vague, but I hope you'll agree that these two formulas look so similar it just feels like there should be some relation between the two. Of course this is not necessarily true, but I'm hoping it's not just a crazy coincidence. Do adjustable length lightsabers exist in Star Wars universe? I always see blades of lightsabers have more or less the same length (dual blades are double). Why is that?  Can't a longer or shorter length be advantage in some case?    I am NOT expecting infinite length lightsabers (due to energy issues), but have we seen adjustable length blades in the Canon? What is the difference between "citizen" and "denizen" Citizen: 1. A legally recognized subject ornational of a state or commonwealth, either native or naturalized. 2. An inhabitant of a particular town or city.  Denizen: 1. An inhabitant or occupant of a particular place.  Same thing? Change installed AppleScript version Nature of gravity: gravitons, curvature of space-time or both? General relativity tells us that what we perceive as gravity is curvature of space-time.   On the other hand (as I understand it) gravity can be understood as a force between objects which are exchanging (hypothetical) virtual particles called gravitons, similar to the way electromagnetic forces are due to objects exchanging virtual photons?  At least at first glance, the two concepts seem mutually exclusive. Is there a description of gravity which includes both, or is this contradiction one of the problems in combining GR with quantum mechanics? If $n&gt;1$ is an integer, then $\sum \limits_{k=1}^n \frac1k$ is not an integer.  If you know , then you know there must be a prime $p$ between $n/2$ and $n$, so $\frac 1p$ appears in the sum, but $\frac{1}{2p}$ does not. Aside from $\frac 1p$, every other term $\frac 1k$ has $k$ divisible only by primes smaller than $p$. We can combine all those terms to get $\sum_{k=1}^n\frac 1k = \frac 1p + \frac ab$, where $b$ is not divisible by $p$. If this were an integer, then (multiplying by $b$) $\frac bp +a$ would also be an integer, which it isn't since $b$ isn't divisible by $p$.  Does anybody know an elementary proof of this which doesn't rely on Bertrand's Postulate? For a while, I was convinced I'd seen one, but now I'm starting to suspect whatever argument I saw was wrong. How to show this function's discontinuity?  $ f(n) = \left\{     \begin{array}{l l}      \frac{xy}{x^2+y^2} &amp; \quad , \quad(x,y)\neq(0,0)\\      0 &amp; \quad , \quad(x,y)=(0,0)    \end{array} \right.$ Ubuntu 16.04 multitouch gestures Explaining two-tailed tests I am looking for various ways of explaining to my students (in an elementary statistics course) what is a two tailed test, and how its P value is calculated.  How do you explain to your students the two- vs one- tailed test? The add comment link and comment box overlaps bounty box Delete commits from a branch in Git The standard titlepage is quite simple. I am looking for a very  and need help customizing my title page.  It should match the  classicthesis doctoral thesis template  Below a minimal working example:   \documentclass[12pt,a4paper,footinclude=true,twoside,headinclude=true]{scrbook} \XeTeXinputencoding iso-8859-1 \usepackage[marginparsep=8pt,left=3.5cm,right=3.5cm,top=3cm,bottom=3cm]{geometry}  \usepackage[parts,pdfspacing,dottedtoc]{classicthesis}    \frontmatter  \begin{document}     \pagestyle{scrheadings}        %this is the place to set up my cover sheet.       %*******************************************************      % Abstract     %*******************************************************    %\renewcommand{\abstractname}{Abstract}    \pdfbookmark[1]{Résumé}{Résumé}   \begingroup    \let\clearpage\relax    \let\cleardoublepage\relax    \let\cleardoublepage\relax       \chapter{Résumé}     Résumé de la thèse en français\dots      \vfill      \chapter*{Summary}   Résumé de la thèse en anglais\dots    \endgroup             \vfill     \end{document}