How do I join getting one row from the left table, no matter how many matches i get from the right table?

I have two tables – one is a data table and the other is a mapping table. I want to join them together, but only preserve the data from the right table. However, it is possible that the match table may contains multiple records that match to a single record in the right table. I cannot use a DISTINCT because there may be identical rows in the right table, and I want to preserve the same number of rows from the right-table in the result set.

Here is a sample of the data I am working with:

       DataTable                           MappingTable +-----+-----+-----+-----+           +------+------+------+------+ | ID1 | ID2 | ID3 | ID1 |           | ID1  | ID2  | ID3  | ID1  | +-----+-----+-----+-----+           +------+------+------+------+ |  1  |  1  |  1  |  1  |           |  1   | NULL | NULL | NULL | |  1  |  1  |  1  |  1  |           | NULL | NULL | NULL |  1   | |  2  |  1  |  1  |  1  |           |  3   |  3   | NULL | NULL | |  3  |  1  |  1  |  3  |           +------+------+------+------+ |  4  |  1  |  1  |  4  | |  2  |  2  |  1  |  1  | |  3  |  2  |  1  |  3  | |  3  |  3  |  1  |  3  | |  2  |  1  |  0  |  1  | |  2  |  1  |  0  |  1  | |  4  |  3  |  2  |  3  | +-----+-----+-----+-----+ 

Below is the join I am using. I wrote a custom function to handle the NULL-matching behavior, which I am including here as well.

SELECT * FROM DataTable P JOIN MappingTable M ON dbo.fNullMatchCheckIntS(P.ID1,M.ID1,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID2,M.ID2,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID3,M.ID3,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID4,M.ID4,0,1) = 1 

CREATE FUNCTION dbo.fNullMatchCheckIntS (     @Value1 INT     ,@Value2 INT     ,@AutoMatchIfValue1IsNull BIT     ,@AutoMatchIfValue2IsNull BIT )     RETURNS BIT AS  BEGIN      DECLARE @Result BIT = 0      SELECT         @AutoMatchIfValue1IsNull = ISNULL(@AutoMatchIfValue1IsNull,0)         ,@AutoMatchIfValue2IsNull = ISNULL(@AutoMatchIfValue2IsNull,0)      IF         (@AutoMatchIfValue1IsNull = 1 AND @Value1 IS NULL)         OR (@AutoMatchIfValue2IsNull = 1 AND @Value2 IS NULL)         OR @Value1 = @Value2         OR (@Value1 IS NULL AND @Value2 IS NULL)     BEGIN         SET @Result = 1     END      RETURN @Result END 

The problem with the way the join works is that the first two rows in the DataTable match on the first two rows in the MappingTable, giving me four identical records in the result, but I only want 2. I know that I could add an identity column to the DataTable and then use DISTINCT or PARTITION to get the result I am looking for, but I would like to avoid that route if possible.

EDIT: I figured out a way to do this using EXISTS, but it looks a little ugly in my opinion. Still interested in other answers if anyone has an idea. Thanks!

SELECT * FROM DataTable D WHERE EXISTS (     SELECT D.ID1, D.ID2, D.ID3, D.ID4     FROM MappingTable M      WHERE dbo.fNullMatchCheckIntS(D.ID1,M.ID1,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID2,M.ID2,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID3,M.ID3,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID4,M.ID4,0,1) = 1 ) 

How to play Appearance straight and right?

There is a very basic structure that all the old and classic World of Darkness, drawing through all the editions and books. However, I never have seen this part played straight and in fact, I have trouble finding many rules that actually use that stat at all:

My problem lies in the “Appearance” score. Everybody has it from 0 to 5 (with some gifts, abilities or trickery some more is possible), but how to play it ‘right’ in a group? This ‘quantified’ appearance does make all sorts of wonky things. Some from my gaming appearance:

  • The Appearance 5 (specialization: alluring) Verbena, who seems to have little to no impact on entering any room. The player constantly asks between rounds “Why don’t people react to a model entering?” My Son of Ether doesn’t react too much usually for on one side he knows what kind of magic she is capable of, and on the other side, he is more a technophile.
  • The Appearance 0 Nosferatu. I have seen several times how a newborn Nosferatu player entered the local vampire court and did not even get any reaction out of ordinary from any of the gathered vampires, not even a whispered ‘oh, another one of those‘.
  • An Appearance 5 (specialization: innocent) Intelligence 1, feline born Simba that I played did actually gain some looks – mostly by using the little exploit to go appearance 6 via shifting to the Sokto form, that gave a straight +1 to appearance. With playing her totally naive, I actually made the ST and other players give some comments about her looks, even if most were along the line “She ain’t got it in the head but in the looks.”

Now… How to actually play the appearance score straight and right according to the RAW? Where are the rules for actually using this score hidden? Are there more actions than things to gain a good ‘first impression’ via Appearance+[Subterfuge/Etiquette/Style/whatever] are tied to Appearance? Does it matter if you play the 1st/2nd/Revised conglomerate or the 20th Anniversary Variant?

WotC Pre-rolled Level 1 Bard Character – Can’t get it right in D&D Beyond

I’m trying to build the nifty 5E Half-elf Bard in D&D Beyond as shared on WotC’s set of pregen character sheets.

However, I just can’t seem to get the ability score values and the skill values to align to what their character sheet PDF says and it’s a real bummer.

Per their character sheet: STR 8 (-1), DEX 16 (+3), CON 14 (+2), INT 12 (+1), WIS 10 (0), and CHA 16 (+3).

And the Character Sheet skills are listed as: Arcana +3, Acrobatics +5, Deception +5, Insight +2, Perception +2, Performance +5 and Persuasion +5.

However, after entering in the ability scores they called out, my Deception is only +3 and my Insight is only 0. I got the rest to align though.

I’ve been at this for 90 minutes but to no avail. Any suggestions on how to make this match the sheet? Trying to make this one for my daughter as a surprise.

How do I detect input from the left or right arrow-keys in c#?

My code is as following

using UnityEngine; using System.Collections;  public class PlayerMovement : MonoBehaviour {     // This is a reference to the Rigidbody compenent called "rb"     public Rigidbody rb;      // This creates variables for the movement     public float forwardForce = 2750f;     public float sidewaysForce = 150f;      // We marked this as "fixed"update because we are using it to mess with Physics     // In this case Unity likes FixedUpdate a lot better than Update     void FixedUpdate()     {         // Add a forward force         rb.AddForce(0, 0, forwardForce * Time.deltaTime);          if (Input.GetKey("a"))         {             // Move player to the left             rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);         }          else         {             if (Input.GetKey("left")                 {                     // Move player to the left                     rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);                 }          }          if (Input.GetKey("d"))         {             // Move player to the right             rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);         }          else         {             if (Input.GetKey("right"))                 {                     // Move player to the right                     rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);                 }          }          if (rb.position.y < -1f)         {             FindObjectOfType<GameManager>().EndGame();         }     } } 

My line of code: if (Input.GetKey("left")) obviously didn’t register the input of the arrowkey. How can I detect arrow keys like this?

How can I fix an Inset plot to the top right corner of the main plot?

I want to export multiple plots and always have a small picture of another plot in the top right corner (as there is no data of the main plot in this region). However, it would be nice if I didn’t have to set the position argument in Inset[] manually, as my y-values change for every plot. Thank you for any help! Below is an example of my code with the export part cut out off the For-loop. The issue is in the last line of the code, where I try to determine the position of the Inset-plot depending on the y-values, which is not working very well.

For[zz = 1, zz <= 4, zz++,  LargeRangePlotLargeM =    ListPlot[{ DeltaDeltaPPS2to5LargeM[[zz]],       DeltaDeltaRS2to5LargeM[[zz]], DeltaDeltaPRS2to5LargeM[[zz]],      DeltaDeltaGHZ2to5LargeM[[zz]]}, PlotMarkers -> "OpenMarkers",     PlotRange -> All];  LargeRangePlotWithLargeM =    ListPlot[{DeltaDeltaPPS2to5[[zz]], DeltaDeltaRS2to5[[zz]],      DeltaDeltaPRS2to5[[zz]], DeltaDeltaGHZ2to5[[zz]]},     PlotLegends -> {"PPS", "RS", "PRS",  "GHZ"},      AxesLabel -> {"M", "FSA"},     PlotLabel -> StringForm["N = ``", zz + 1],     PlotMarkers -> "OpenMarkers",  PlotRange -> All,     Epilog ->      Inset[LargeRangePlotLargeM, {750,        2 * DeltaDeltaGHZ2to5[[1]][[2]][[2]]}]]; ] 

Simpler code with the same question might look like this:

p2 = Plot[Sin[x], {x, 0, \[Pi]}]; pcombined =   Plot[Sin[x], {x, 0, 2 \[Pi]}, Epilog -> Inset[p2, {5, 0.5}]] 

How do I now define the position argument inside Inset in a way that it moves the plot to the top right corner without having to choose plot specific values manually?

Placement of Help button: left or right to OK/Cancel

I’m adding help to a Windows desktop application that is being in use since the Windows XP era. All the modal dialogs display the typical OK/Cancel button set placed at the bottom right as shown in this example/placeholder screenshot (in fact no MessageBox has a Help button):

enter image description here

I wish to cause minimal confusion to my users after the next release that’s why I hesitate to place the Help button right to the Cancel button. The standardized order shown by the Win32 MessageBox function when called with MB_OKCANCEL | MB_HELP in the uType parameter would shift the already existing buttons to right (replacing OK by Cancel and Cancel by Help) like this:

enter image description here

I searched the web for this, but it turned out to be very hard to get useful answers when combining help, button, and placement, nevertheless I found some screenshots with help buttons bottom left which looks good and useful from my POV.

Where should I place the Help button to the dialogs of an old-fashioned application?