Below is some repro code for an issue I am having.  Run it in SQL SERVER 2017 you will get different (and incorrect) result compared with any other SQL SERVER version Setting the database to lower compatibility level on the sql Server 2017 instance, it works fine too.  Why does this happen and how can I fix it without changing the compatibility level?  Actual Result  +--------------+--------------+----------------+---------+-----------+---------+------------+-------+ | IsPriorAfter | IsIdealAfter | IsCurrentAfter | IsPrior | IsCurrent | IsIdeal | SecurityID | PosID | +--------------+--------------+----------------+---------+-----------+---------+------------+-------+ |            1 |            1 |              1 |       1 |         1 |       1 |        123 |     1 | |            0 |            0 |              0 |       0 |         1 |       1 |        234 |     2 | |            0 |            0 |              0 |       1 |         0 |       0 |        234 |     3 | +--------------+--------------+----------------+---------+-----------+---------+------------+-------+   Expected Result  +--------------+--------------+----------------+---------+-----------+---------+------------+-------+ | IsPriorAfter | IsIdealAfter | IsCurrentAfter | IsPrior | IsCurrent | IsIdeal | SecurityID | PosID | +--------------+--------------+----------------+---------+-----------+---------+------------+-------+ |            1 |            1 |              1 |       1 |         1 |       1 |        123 |     1 | |            0 |            1 |              1 |       0 |         1 |       1 |        234 |     2 | |            1 |            0 |              0 |       1 |         0 |       0 |        234 |     3 | +--------------+--------------+----------------+---------+-----------+---------+------------+-------+   Repro  if object_id('ForSubQuery') is not null begin     DROP TABLE ForSubQuery end Create Table ForSubQuery (        SecID int )  INSERT INTO ForSubQuery SELECT 123 INSERT INTO ForSubQuery SELECT 234  GO  SELECT * FROM ForSubQuery  if object_id('MainTable') is not null begin     DROP TABLE MainTable end Create Table MainTable (        IsPrior bit,     IsCurrent bit,     IsIdeal bit,     [SecurityID] int,     PosID int )  INSERT INTO MainTable SELECT 1,1,1,123,1 INSERT INTO MainTable SELECT 0,1,1,234,2 INSERT INTO MainTable SELECT 1,0,0,234,3  GO  SELECT * FROM MainTable  SELECT         CASE             WHEN                 Position.IsPrior = 1                 AND Position.[SecurityID] in (SELECT                 SecID                 FROM ForSubQuery                 )                                 THEN 1             ELSE 0         END AS IsPriorAfter        ,CASE             WHEN                 Position.IsIdeal = 1                 AND [Position].[SecurityID] IN (SELECT                         secid                 FROM ForSubQuery                                 )                  THEN 1             ELSE 0         END AS IsIdealAfter       ,CASE             WHEN                 Position.IsCurrent = 1                 AND [Position].[SecurityID] IN (SELECT                         secid                 FROM ForSubQuery                     )                  THEN 1             ELSE 0         END AS IsCurrentAfter     , Position.*     FROM MainTable [Position]     order by Position.PosID
Consider a database table holding names, with three rows:  Peter Paul Mary   Is there an easy way to turn this into a single string of Peter, Paul, Mary?
I have 2 quartz crystal resonators in my pcb board: 32.768 kHz &amp; 20 MHz. They are connected to a Freescale MC12311 transceiver IC, which has an HCS08 micro-controller embedded in it. I want to test if these crystals are working properly or not.  Available tools: Oscilloscope, Frequency-Meter (Digital Counter), Digital Multimeter.  How should I use these tools to test the crystals in board?   Note: The capacitive load-effect of probes should probably be considered. If not, the measurement would not be accurate, or even worse, the crystals would not work at all.     Edit1: I used both the oscilloscope and the frequency-meter (with x10 probes), but unfortunately there was nothing monitored at all. Why does the "Unanswered Questions" tab show questions that have answers? How to specify password in ssh command From the terminal I type: ssh user@ip and then it prompts for a password.  Is there a way to specify the password in the ssh command itself? Leave bash script running on remote terminal while not logged in? I have a bash script that takes several hours to run.  While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).  I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs.  Does anyone know what this command is? How fast does gravity propagate? I am not sure what caused this error, but here is what the whole error says, and also this is sitting as a notification, and preventing me from updating any software using Update Manager - Please provide some assistance or tell me how to figure out what to do to fix it.  Could not calculate the upgrade  An unresolvable problem occurred while calculating the upgrade.  Please report this bug against the 'update-manager' package and include the following error message: 'E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' From Euler we've learned that $z=re^{i\theta}$.  And it's easy to see that $|z|^2=r^2$, since $re^{i\theta}\times re^{-i\theta}=r^2$.  Why must we use e to represent these numbers correctly? It seems that I could arbitrarily choose a different exponent $z=r\pi^{i\theta}$ and get the same size for $z$ as I did before: $|z|^2=r\pi^{i\theta}\times r\pi^{-i\theta}=r^2$  What did I miss? Should I use center or centering for figures and tables? What is the correct way to center figures and tables (figure, table)?  \begin{center} ... \end{center}   or   \begin{centering} ... \end{centering} How can I set custom key bindings and key macros on Mac OS X? I recently upgraded to Snow Leopard, from Leopard and I was using an awesome app called  that let you remap your keys, set scripts/macros and even had repeat functionality.   However, this app doesn't seem to be in active development anymore, and 10.6 broke the ability to bind certain modifier keys (Shift) with other keys.   I totally miss things like Shift+Insert for paste (Linux/Windows), setting Ctrl+Shift+Esc for Activity Monitor, and Ctrl+Alt+Del for the login window.   So, how can I achieve this instead? Bought a new battery, do I need to calibrate it? My original battery is bloated and is dying quickly after a full charge so I now bought a replacement. Do I need to calibrate this new battery using a calibration app? Below you find the design for our business cards. The triangles are yellow, as you can see outside of the canvas. However, inside the canvas, only when I set the Color Mode to CMYK, they appear pink. When I switch the Color Mode back to RGB, they appear yellow as expected. However, when I print them, in both cases they turn out pink...   I would just like to know what is going on here and how I can change them back to the right colors?  CMYK Colors: Continuity of $f(x)$ on $[a,b]$ implies continuity of $f(t) = \displaystyle \min_{a \leq x \leq t}f(x)$ at [a,b]. I am already dual booting windows 10 with Linux Mint, and I am trying to replace Mint with Ubuntu. I have already created a bootable usb for Ubuntu.  When I try to install Ubuntu, I don't see any option to install Ubuntu alongside windows 10. Rather, I see "install Ubuntu alongside Linux Mint". I didn't find any option to keep my windows 10. How can I replace Mint with Ubuntu in this dual boot system? Mint is installed on an ext4 partition and I have a Linux swap partition. I am embedding a PDF file inside my LaTeX-generated PDF file using embedfile:  \usepackage{embedfile} \embedfile{myfile.pdf}   I would like to also insert a link that the user can click on to open the attachment.  Is there any way to do that? Any way to do DISTINCT ON? I'm trying to create a query like this:  SELECT DISTINCT ON (field1, field2) field1, field2, field3 FROM table1   But can't figure out how to get DISTINCT ON narrowed down to a few fields in Drupal like that. Calling $query-&gt;distinct() just seems to structure the query like this:  SELECT DISTINCT field1, field2, field3 FROM table1   I did figure out a hacky way to add what I want by adding an expression before I add any fields like this:  $query-&gt;addExpression('DISTINCT ON (field1, field2) field1', 'field1');   Which creates:  SELECT DISTINCT ON (field1, field2) field1 as field1, field2, field3 FROM table1   I'm looking for a better way to this ? Can I travel to Paris for a day with a single entry visa for Schengen from Switzerland? I am visiting a friend in Switzerland for ten days. I have already got visitor's visa for the same on my Indian passport. Particulars mentioned on my visa are:  1. 'Etats Schengen' , 2. Single entry 3. Dates of visit. &amp; 4. Type of visa : C.  I understand that having already got ‘Etats Schengen' visa, I can travel to all Schengen countries.  I am also planning to visit Paris for a day during my stay in Switzerland. However, I never mentioned this in my visa application. I am planning to take a train from Geneva to Paris and book a hotel in Paris for one night. Can I possibly plan my Paris trip this way as I have Schengen visa, or I am not allowed to travel out of Switzerland as I never mentioned this in my visa application?   Also what does Single entry on my Schengen visa means: does it mean that I can enter and leave Switzerland only once or it means that I can enter and leave the Schengen region only once. A student is applying to a PhD program in Computer Sciences at Harvard and MIT. He estimates that he has two out of three chances of being accepted at Harvard and two out of five chances at MIT. He further estimates the probability that he will be accepted by both has probability of one to five. What is the probability that he is accepted by MIT if he is accepted by Harvard? Is the event "accepted by MIT" independent of the event "accepted by Harvard".  I don't understand if these are odds or probabilities I have this function $$f(x) = x\cos(1/x)$$ defined for all $x \geq 1$.      How do I prove that    $$f(x+2)-f(x)&gt;2$$    for all $x\geq 1$?   I found $$f'(x)= \cos(1/x) + \frac{\sin(1/x)}{x}$$ and $$f''(x)=-\frac{\cos(1/x)}{x^3}.$$ How do i use this information? Is it possible to make LaTeX mark overfull boxes in the output? Why do we say that the Earth moves around the Sun?