I allow myself to write a thread regarding a query I’m trying to make for hours now. I’m trying to get the name of the friend (friend.first_name) who refuses the most proposed dates for events. To do this I’m counting the number of proposed date and ORDER BY ASC. However, this does not take …
Tag: sql
Sql to count m and f based on age [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 9 months ago. Improve this question i have sql table like this table name: person age gander 21 m 21 m 21 f 22 m 22 f what is q…
How to order columns results in another column (SQL Server)
I have this table The key columns in my table are RowCnt , Lvl , a_TargetID , b_TargetID I want to put the name of the column as the order of their value in the a_1st a_2nd a_3rd a_4th so the final results will be like this I can do this but it seems very wrong I wonder if someone
Julia: How to get dataframe value into single variable
I am modifying Julia code that I did not write myself. I have worked very little in Julia. I’ve concatenated a string to create a SQL Query that returns a single integer value from the database. I want to use the returned value in the next sql string. However, the value returned from the initial SQL Sel…
Create subquery using peewee, using `.select` on the subquery results
I have a rather complex peewee query that looks like that: This one actually works, generating the following SQL query: But I don’t really want to use RIGHT_JOIN as it isn’t supported by SQLite. When trying to query using the subquery query and JOINing the Solution table into the subquery’s …
Duplicate records in table after left join
I have three tables. “Departments” table: department_name, department_id. Table “LowPrice”: departmend_id, product_name, purchased, sold, price. Table “Basic”: departmend_id, product_name, purchased, sold, price. In the tables “Basic” and “Low” there…
Access SQL Query to display the most recent date only for duplicate records
Below is my current MS Access SQL that displays all records. However, If there is a duplicate account record, it should only display the record with the latest date ComputationPeriodStartingDate Dataset example. All non duplicates should be returned, Account 1005 is the only duplicate of which only the one da…
Trying to delete duplicate rows in SQL Server where the difference is the date or batch number
I have this query: Which is returning the following results ID_NUMBER INCEPTION_DATE OCCURRENCE TRANSACTION_DATE FILE_LOAD_DATE BATCH_NUM 112897732 2008-09-15 4 2008-07-03 2008-07-07 17:57:19 06341 112897732 2008-09-15 4 2008-07-13 2008-07-18 03:35:55 06753 828194721 2008-11-11 1 2008-09-06 2008-09-17 02:50:4…
php stop sql query from running every time on refresh
In my php script, I used a sql query to create a table, but after creating the table every subsequent refresh will return an error message stating table is already created. I know its already created but how do I stop query from running a second time on refresh if its already ran? php script: Answer The DDL c…
Take maximum time during update left join mysql
I am doing an update left join on ID and receiver. How can I make the query to pick the record with max time taken? Expected output : Answer I have added another column (id_primary) in right_table. To get the maximum use this subquery (select id_primary from right_table order by time_taken desc limit 1) at en…