Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about conditional-aggregation

Read more about conditional-aggregation

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - conditional-aggregation

Single columns from several rows into several columns in one record, but allow NULL in the rows

I'm trying to combine single rows from multiple records into several columns in one record. Say we have a database of people and they've all chosen 2 numbers. But, some people have only chosen 1 numbe...
test-img

lemuria

sql

sqlite

group-by

left-join

conditional-aggregation

Votes: 0

Answers: 1

Latest Answer

You can use conditional aggregation: SELECT p.*, MAX(CASE WHEN c.type = 'first' THEN c.chosen_num END) AS first_num, MAX(CASE WHEN c.type = 'second' THEN c.chosen_num END) AS second_num ...
test-img

forpas

Room/SQLite returning two different results in one query

So I've got the following queries: //returns min max value my odomoter field must have @Query("SELECT MAX(odometer) FROM MaintenanceRecord WHERE vehicleId = :maintenanceVehicleId AND " + ...
test-img

igodie

android

sqlite

android-sqlite

android-room

conditional-aggregation

Votes: 0

Answers: 1

Latest Answer

You can use conditional aggregation to get both columns in a single query: SELECT MAX(CASE WHEN maintenanceTs < :dateAsLong THEN odometer END) AS max_odometer, MIN(CASE WHEN CAST(strftime('%...
test-img

forpas

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved