Wikipedia:Reference desk/Archives/Computing/2024 February 29

= February 29 =

Need an iphone user to take a quick look at this
We are having difficulty finding another iphone user with an iphone bigger than the smaller iphone SE 2020 that I have. Most iphones are bigger. We only need a few minutes of your time for a sticky header test. If you have an iphone please have a look at this test: Specifically: Please tell us if sticky table headers work without problems in these sandboxes: It should only take a minute to look at the table in that section. And another minute to report what you are seeing at the Village Pump. Please report there, and also tell us what iphone model you have. Thanks. --Timeshifter (talk) 01:34, 7 March 2024 (UTC)
 * Village pump (technical)
 * Current styles: User:Timeshifter/Sandbox244
 * Proposed styles: User:Timeshifter/Sandbox243

Oracle SQL - using one case/when on multiple columns
I have a set of sales data that I want to de-normalize by fiscal year. For example, I would do SUM(CASE WHEN S.FISCAL_YR = 2024 THEN S.SALES_AMT ELSE 0 END) as CY_SALES, SUM(CASE WHEN S.FISCAL_YR = 2023 THEN S.SALES_AMT ELSE 0 END) as LY_SALES and so on. They're all bucketed that same way - by the two fiscal years - but some of them are very much more complicated than just bringing back a single field like SALES_AMT. What I am wondering is if there's a way to introduce a case statement and have it apply to multiple columns being returned. For example, a case statement that said CASE WHEN S.FISCAL_YR = 2024 THEN... and then listed a bunch of columns to return that were all for 2024 and then another case statement for 2023's columns. I feel like it would make the SQL much easier to update and error check. I've done some searching, but the responses seem to be similar but different problems involving subqueries to different tables. I have everything in one table and the fiscal year is already a field, so it seems doable, but I can't get the syntax to work correctly. Matt Deres (talk) 14:55, 29 February 2024 (UTC)
 * Your query does not place current and last year sales side by side. It places a zero in one column and a value in the other. Each entry on a different row. I would union two subqueries. I don't know your end task, but I would do it like:

select * from mytable where fiscal_yr=2024 union select * from mytable where fiscal_yr=2023
 * That is a starting point. Now, you can change the * in each subquery to get what you want. For example, you can select sale_amt as cy_sales_amt in the first one and sale_amt as ly_sales_amt in the second one. You need to have the same number of columns, so you will actually do:

select sales_amt cy_sales, 0 ly_sales from mytable where fiscal_yr=2024 union select 0 cy_sales, sales_amt ly_sales from mytable where fiscal_yr=2023
 * Now, it is easy to include whatever columns you want. Just make sure both subqueries have the same fields in the same order. 12.116.29.106 (talk) 13:25, 5 March 2024 (UTC)


 * It does place 2024 and 2023 side by side. If I sold 10 hamburgers in 2023 and 14 in 2024, it would have CY_SALES of 14 and LY_SALES of 10. This then makes it very straightforward to compare the two amounts in Excel or where-ever. Your method would place hamburgers on two rows, taking up extra space and complicating comparisons. Matt Deres (talk) 15:57, 6 March 2024 (UTC)

iPhone users 2
Just wondering whether any other iPhone users failed to get their usually very reliable reminder to put the bins out tonight. Something to do with it being 29th February maybe? Shantavira|feed me 18:34, 29 February 2024 (UTC)
 * You might want to specify what app you are using for the reminders. RudolfRed (talk) 04:11, 1 March 2024 (UTC)
 * It's a standard app called "Reminders". Shantavira|feed me 10:19, 1 March 2024 (UTC)
 * If it's a leap year bug and you only care about you thursday bin (trash/recycle day) reminder, you will probably have to wait until 2052 to see if it recurs. -- Tom N talk/contrib 02:58, 4 March 2024 (UTC)