Hoping someone with Access & SQL experience would be able to write some SQL code that I could use in MS Access to transform/unpivot some data. I’ve spent a day trying advise from others who have asked similar questions here, but I have no SQL experience and have failed miserably so far. Answer You c…
Tag: sql
MYSQL select name from id [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I need to get the name from the author id in table post. I have these 2 tab…
python sqlite3 partial search
I want to do a partial search with python sqlite3. My initial query is: Then I tried using the LIKE keyword and string formatting to obtain partial search results for the title, like this: As in https://stackoverflow.com/a/20904256/13290801 This seems to do the trick for title, but now when searching on the o…
PHP array into individual php string, from SQL data
Here is a PHP code, that can be used to count data from SQL. This code displays the data in a table, I want to convert these table values (or arrays) into individual php strings. How can I do that ? I tried many methods, main issue is my lack of proper knowledge in PHP. I hope someone will help
MySQL – Performance issue while joining most recent
I have two tables, markets (27 records) and histories (~1.75M records, ~67K per market). I need to get every market with its most recent histories record. The solutions I tried work but are incredibly slow. Tables DDL What I tried 1 – Uncorrelated subquery I started with this solution since I used it ot…
SQL – cartesian product of PARTITIONs
There is a really complicated query, which I cannot wrap my head around alone. In the queried table there are 5 columns: PK_ID, which is the unique identifier of the value, ID, which connects the aggregated values in one group, the count, which says, how many value groups should be aggregated (if there aren&#…
Access Values from a customer table to a room type table
I’m Stuck in the middle of my MySQL project. Basically for now I have three tables Room_Type, Room, Customer. Read my code for Room_Type Table and in Room Table, there’s a foreign key through which I can access its room_type (Standard, deluxe, etc) and in the customer table, there’s a foreig…
Better solution to index a DataFrame according to the values of 2 others
I would like to index a DataFrame (aaxx_df) according to the values of 2 others (val1_df for the columns and val2_df for the rows). I put below a solution that works for my problem, but I guess, there must be some much cleaner solutions, possibly via SQL (it seems to me to be very similar to a relational data…
Simple PostgreSQL Self Join
This is what my employee table looks like where manager_id is Foreign Key to the same table it references to employee_id and indicates which employee has manager and who is. I did self left join and the result was what was expected. But this query gives me So I don’t understand why it returns something …
Selecting first and last time stamps of a section
I have a MySQL database with a table like: I would like to select from this table the first and last timestamp for each value of each Batch_Number. I would like the table to look like: I am not sure how to select both, when the previous Batch_Num is different from the curent one, and also when the next one