For instance, Washington, D.C. produces no food of its own (excluding neighborhood gardens) as the District contains no farmland within its borders. The Potomac is polluted, meaning fishing is not a viable source of food either. Virginia and Maryland have farmland, though the counties and cities in either of these states in the DC metro area either do not have farmland or have very little farmland.
All of these counties and cities get their food via truck, train, ship or some combination thereof. Modern transportation has made it so we no longer have to have farmland nearby to avoid spoiled food.
Even if a city would only consume wind and solar, it's quite likely that the majority of solar panels and wind turbines would be installed outside of the cities themselves.