Ben Zanin on Nostr: Is there an idiomatic SQL (sqlite3) way of mapping a subset of selected records from ...
Is there an idiomatic SQL (sqlite3) way of mapping a subset of selected records from a large table ("users") to unique values in a smaller table ("coupons")? It's easy enough to _select_ all the user records not yet mapped, and to select all as-yet unmapped coupons, but then what's a nice clean way of mapping one to the other? Order doesn't matter, only that the mapping once established can be queried again in the future.
My brain is stuck thinking sequentially about this, frustratingly.
Published at
2024-05-14 02:30:13Event JSON
{
"id": "67dafb2014557e83034a7436035664fe82b55f52ae3132ca69a87da60aa1c00d",
"pubkey": "5615c9eb09a4bd9f53623329894c84e60f0cd95d811afbbd8791e2930ad9d3fe",
"created_at": 1715653813,
"kind": 1,
"tags": [
[
"proxy",
"https://mastodon.social/users/gnomon/statuses/112437088331008391",
"activitypub"
]
],
"content": "Is there an idiomatic SQL (sqlite3) way of mapping a subset of selected records from a large table (\"users\") to unique values in a smaller table (\"coupons\")? It's easy enough to _select_ all the user records not yet mapped, and to select all as-yet unmapped coupons, but then what's a nice clean way of mapping one to the other? Order doesn't matter, only that the mapping once established can be queried again in the future. \n\nMy brain is stuck thinking sequentially about this, frustratingly.",
"sig": "8708ed3672f3d2b7a3c39957112d28713ad68a43f5bc64f13973107fcc132c2498f393f262460f8044fb989d85457179b28ceb37fa24d177986e600112f3592e"
}