Skip to content

bug in sql.md: fix the query to ignore nulls #1738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ Plot.plot({
marks: [
Plot.axisY({tickFormat: (d) => d / 1000, label: "count (thousands)"}),
Plot.rectY(await sql`
SELECT
FLOOR(phot_g_mean_mag / 0.2) * 0.2 AS mag1
, mag1 + 0.2 AS mag2
, COUNT() AS count
FROM gaia GROUP BY 1
SELECT FLOOR(phot_g_mean_mag / 0.2) * 0.2 AS mag1
, mag1 + 0.2 AS mag2
, COUNT() AS count
FROM gaia
WHERE phot_g_mean_mag IS NOT NULL
GROUP BY 1
`, {x1: "mag1", x2: "mag2", y: "count", tip: true})
]
})
Expand Down