How can I retrieve the oldest record from a joined table in SQL with distinct values for a specific column and a certain condition?

I want to get distinct vale for column "ID" with condition "Status"=1 and pick the oldest "Date". There are 2 tables:Table1 | ID | Code | Date | |——— | ———|———-| |A123 |1234 |10/9/2018 | |A123 |7890 |9/8/2022 | |B666 |9088 |1/2/2021 | |C7633 |1048 |2/5/2019 | |A123 |5477 |8/3/2022 | Table2 | Code |… Read More How can I retrieve the oldest record from a joined table in SQL with distinct values for a specific column and a certain condition?

Replace column values using another pandas dataframe mapping

Imagine I have the following dirty data of employee information of their contracts across countries (df1): ID Country Name Job Date Grade 1 CZ John Office 2021-01-01 Senior 1 SK John . 2021-01-01 Assistant 2 AE Peter Carpinter 2000-05-03 3 PE Marcia Cleaner 1989-11-11 ERROR! 3 FR Marcia Assistant 1978-01-05 High 3 FR Marcia 1999-01-01… Read More Replace column values using another pandas dataframe mapping

How to use dumpdata and loaddata for Django Groups with some permissions?

While writing testcases, I required fixtures or we can say json data to pre-populate database. I have a project which is using Django Groups and Permissions models. Now, when I use command for dump data python manage.py dumpdata auth.Groups > fixtures/groups.json It will dump all data in groups.json file as show below. Note: groups are… Read More How to use dumpdata and loaddata for Django Groups with some permissions?

Group JavaScript Object by group id

I have a JavaScript object as below [{ "id": "41e4858d-0478-4ffa-b39a-73db6f80c493", "price": 10, "class": "audi", "group": { "id": "group-1", "name": "Special", } }, { "id": "d4ed6efe-3d95-4f19-9f34-16b1d62ee5f1", "price": 20, "class": "mercedess", "group": { "id": "group-1", "name": "Special", } }, { "id": "a17a3671-09c4-411c-921f-a35705e86030", "price": 30, "class": "bmw", "group": { "id": "group-1", "name": "Special", } }, { "id": "1bda1fe8-c326-46f4-851c-d06c686d1ebc",… Read More Group JavaScript Object by group id

How to find keys from undefined schema

Suppose I have following array array = [ { optionA: "QA1", optionB: "QB1", optionC: "QC1", optionD: "QD1", }, { optionA: "QA2", optionB: "QB2", optionC: "QC2", optionD: "QD2", optionE: "QD2", }, { optionA: "QA3", optionB: "QB3", } ] Expected output tableHeader = {OptionA,OptionB,OptionC,OptionD,OptionE} Wanted display questions data in a table format, which is not organised and… Read More How to find keys from undefined schema