Some say the nursery rhyme refers to Richard of York, the father of Edward IV and Richard III. In December 1460, he “gave battle in vain” at Wakefield during the Wars of the Roses, and was killed by the Lancastrians. However, a more likely candidate is Frederick, Duke of York, the second son of King George III.
Frederick was Commander-in-Chief of the British Army for much of the Napoleonic Wars (except for a brief period when he resigned after his mistress was found to be taking bribes to influence the appointment of officers). In 1794, he led an army in an unsuccessful campaign against the French in the Low Countries – and it’s probably this campaign to which the nursery rhyme alludes. Though he showed little talent as a general, Frederick was an able administrator, and made a number of important reforms to the Army, improving the lot of the common soldier. He’s commemorated by a statue on a granite column at Waterloo Place in London.