Scema:  Person(pid:int,        name:char(20),        predecessor:int -&gt; Person.pid       )   Example Table:  pid, name, predecessor 0,   'abc', NULL 1,   'bcd', 0 2,   'cde', 1 3,   'efg', NULL 4,   'fgh', 3   How do i find all successors of a Person 'abc'?  Desired Ouput:  name  'bcd' 'cde'    Many Thanks!
I have a table similar to this:  CREATE TABLE example (   id integer primary key,   name char(200),   parentid integer,   value integer);   I can use the parentid field to arrange data into a tree structure.  Now here's the bit I can't work out. Given a parentid, is it possible to write an SQL statement to add up all the value fields under that parentid and recurse down the branch of the tree ?  UPDATE: I'm using posgreSQL so the fancy MS-SQL features are not available to me. In any case, I'd like this to be treated as a generic SQL question.  BTW, I'm very impressed to have 6 answers within 15 minutes of asking the question! Go stack overflow!
I recently put a bounty on a question regarding the . I did this as the only two answers on that page are not satisfactory and I wish to encourage a tractable answer.  I am concerned that when the bounty period expires, if I do not select an answer for the bounty that it may be awarded automatically to one of these speculative and unsatisfactory answers. How might I prevent that? I could put an answer of my own stating "no satisfactory sources are available" and award the bounty to that, however I feel that there should be a better way.  I stress that I put the bounty on the question specifically because the current answers are not satisfactory and I do not want to award them. Shortcut for "null if object is null, or object.member if object is not null" To find tangents to given circle from a point outside it Find the combined equation of two tangents drawn from $P(x_1,y_1)$ to the circle $x^2+y^2 = a^2$. Point $P$ lies outside the circle. Energy conservation in General Relativity I understand that energy conservation is not a rule in general relativity, but I'd like to know under what circumstances it can still be possible. In other words, when is it possible to associate a potential energy to the gravitational field, so that the energy is constant in the evolution of the system?  Here are some examples, is there a convenient way to define energy in these scenarios?   Just a system of gravitational waves. A point mass moving in a static (but otherwise arbitrary) space-time. Equivalent (if I'm not mistaken) to a test mass moving in the field of a second much larger mass, the larger mass wouldn't move. Two rotating bodies of similar mass.   Overall, I'm trying to understand what keeps us from associating a potential energy to the metric. When we break the time translation symmetry of a system by introducing an electromagnetic field, we can still conserve energy by defining an electromagnetic potential energy. Why can't we do the same when we break TT symmetry by making space-time curved? Copy from Evernote to Paste to Wordpress preserving formating Is it possible to post texts directly from the Windows desktop Evernote application to Wordpress, and retain the formating? Simple copy/past leads to format break. Concatenate multiple rows How to prove that $a \cdot b$ is not divisible by 5 for $\frac{1}{1} + \frac{1}{2} + ... + \frac{1}{99} + \frac{1}{100} = \frac{a}{b}$? How can I play around targeted discard? Many decks in competitive Magic have access to targeted discard spells, like  and .  Against counterspells, you can rely on a variety of tricks like baiting counters, bottlenecking your opponent's mana, and good old-fashioned counter wars. Targeted discard cards allow your opponent to attack your hand on the very first turn of the game, and go right for your key cards &mdash; and it can often be backbreaking when your opponent takes away a crucial card like a combo piece or a sweeper.  What tricks and tactics can you employ, either during deck-building or in play, to play around an opponent's targeted discard?  (I know that one of the answers is going to be . That's excellent, but please also include approaches that work in formats without free countermagic.) So to help prevent brute force attacks against my phpmyadmin install I've configured nginx to require HTTP Basic Auth (extra username and password) and then the requests need to come from a whitelisted IP Address. However the IP Address whitelist works fine if I run  however without adding the extra .php block I could load  without my IP being whitelisted. This issue doesn't affect the HTTP Basic Auth. Is there a reason this happens? Anyway to get around having to add extra .php blocks? A copy of the config area for phpmyadmin is below.  # Setup and secure phpMyAdmin location /phpmyadmin/ {   allow 1.2.3.4;   deny all;   auth_basic "phpMyAdmin - HTTP Basic Login";       auth_basic_user_file /etc/nginx/pma_pass;     location ~ \.php$ {     include snippets/fastcgi-php.conf;             fastcgi_pass unix:/run/php/php7.0-fpm.sock;     allow 1.2.3.4;     deny all;     } } What is Skynet's ultimate goal after defeating the resistance? L1 & L2 Regularization in Light GBM This question pertains to L1 &amp; L2 regularization parameters in Light GBM. As per official documentation:  reg_alpha (float, optional (default=0.)) – L1 regularization term on weights.  reg_lambda (float, optional (default=0.)) – L2 regularization term on weights  I have seen data scientists using both of these parameters at the same time, ideally either you use L1 or L2 not both together.   While reading about tuning LGBM parameters I cam across one such case: Kaggle official GBDT Specification and Optimization Workshop in Paris where Instructors are ML experts. And these experts have used positive values of both L1 &amp; L2 params in LGBM model. Link below (Ctrl+F 'search_spaces' to directly reach parameter grid in this long kernel)      I have seen same in XGBoost implementations.  My question is why use both at the same time in LGBM/XGBoost.  Thanks. I swear I read an ingame hint that said Workshops would share my stuff between them, but that doesn't seem to be the case. I have a settlement at Sanctuary and Red Rocket Truck Stop, but I can't access my items I added in Sanctuary at RRTS. Am I mistaken in remembering that you could do this, or is there something I need to do to get that to work? two conditions in one sentence using would EXTRA PROBLEM I have NEI on minecraft with some other mods and NEI is supposed to have a saves thing on the left, and items on the right. The only thing on the left is the options. I want to see the saves and time changing options too.  Cheat Mode When I click on a item to get it it keeps showing me the recipe. Though in the options menu from NEI it is on cheatmode. I saw another post saying I need to change something to this lockmode=-1 or cheatmode=2 but it is already that way. That didn't work how do i get it to give me the items and also recipe when I press R. Wrong ordering in generated table in jpa Does "corresponding author" carry an implied meaning? What do I need to install LED strip lighting? I've been looking to install LED strips, either RGB or white for lighting and ambiance. It wouldn't be the main lighting of the room, so no necessity for high power LEDs.  The perimeter of the room is a little less than 25 meters. Looking around in online stores, I saw that the reels come in maximum lengths of 5 meters, so I would need five of those.  What I'm not sure is how to connect the strips together.  I was looking at , or  with .  If I choose the white LEDs, what power supply, controller, and connector would you recommend to be able to daisy chain the strips?  If I choose the RGB LEDs, what kind of data repeaters would work to be able to control all the strips at once? If "No One" uses a face from the Hall of Faces to become someone then how did he do this on StackOverflow, I asked a . There are many good answers but I can not accept just one of it. I would prefer to create my own answer where I summarize all answers. Is that allowed? Setting knots in natural cubic splines in R I have data with many correlated features, and I want to start by reducing the features with a smooth basis function, before running an LDA. I'm trying to use natural cubic splines in the splines package with the ns function.  How do I go about assigning the knots?  Here's the basic R code:  library(splines) lda.pred &lt;- lda(y ~ ns(x, knots=5))   But I have no idea about how to chose the knots in ns.