home / content

Menu
  • Sign in with GitHub

Timeline Count

Custom SQL query returning 1 row (hide)

with combined as (
  select
    'news' as item_type,
    null as title,
    body
  from news
  where coalesce(nullif(cast(:news as text), ''), '1') = '1'
  union all
  select
    'blog' as item_type,
    title,
    coalesce(summary, '') as body
  from blog_posts
  where coalesce(nullif(cast(:blog as text), ''), '1') = '1'
  union all
  select
    'release' as item_type,
    repos.name || ' ' || releases.tag_name as title,
    coalesce(releases.body, '') as body
  from releases
    join repos on releases.repo = repos.id
  where releases.draft = 0
    and coalesce(nullif(cast(:release as text), ''), '1') = '1'
)
select count(*) as total
from combined
where coalesce(:q, '') = ''
   or title like '%' || :q || '%'
   or body like '%' || :q || '%'

Parameters

Edit SQL

Export data

timeline-count

Query results from the timeline-count query with news = "", blog = "", release = "", q = ""

TSV All 1 row
Tab-separated values, for pasting into Excel or Google Sheets
CSV All 1 row
Comma-separated values, for spreadsheets and other tools
  • JSON All 1 row
    Rows inside an object, with extra details
    View Download
  • JSON array All 1 row
    Just the rows, as an array of objects
    View Download
  • Newline-delimited JSON All 1 row
    One JSON object per line
    View Download

total
2013
Powered by Datasette