I have a table with duplicate records, where I’ve already created a script to summarize the duplicate records with the original ones, but I’m not able to delete the duplicate records. I’m trying this way: The idea was to take the last record of each COD_PLANO_PAGAMENTO and delete it, but thi…
Tag: sql
How can I print the connected database information (such as db name) in PHP?
I am trying to execute an SQL query in PHP but even though the DB has been connected it returns 0 rows, but when I try to execute the same query in MSSQL it returns a row. I have tried the one below but it returns just Boolean false: Here is how I execute my query: I just want to
Insert multiple values from ListBox with stored procedure
I have two related tables, the first called postaDip (IDpostaDip, CODdip, CODposta, from) and the second called cassPosta (IDposta, Desc). I am trying to insert multiple rows into the postaDip table through a listbox that loads the table cassPosta. For example I would like to insert multiple lines of as many …
SQL result dense Rank in revolving group pattern
Say I have a table like store date is_open Bay 1/1/2022 true Bay 1/2/2022 true Bay 1/3/2022 true Bay 1/4/2022 false Bay 1/5/2022 false Bay 1/6/2022 false Bay 1/7/2022 true Bay 1/8/2022 true Bay 1/9/2022 true Walmart 1/7/2022 true Walmart 1/8/2022 false Walmart 1/9/2022 true I want them to use partition by and…
Updating HTML Table Every 60 Seconds
I am trying to use an ajax call to update an HTML table every 60 seconds on a flask app. I am very new to flask and jquery, and followed this similar stackoverflow question: Python Flask Refresh table every 60 seconds However my table isn’t displaying any data. Currently my app.py file is setup as below…
Pagination with grouping
I have a table with over 800K records. This table needs to be “grouped by” a certain column. An example would be: However, with pagination, things get complicated. I want to show 50 rows for every group. This means that if I have the following data: Id Color Name 1 Red Paper #1 2 Red Paper #2 3 Re…
Join tables together
I need to write a SQL statement to find the ‘Action’ (category) films with the shortest running time (length). Your query should output the titles and lengths of the films. This is the database schema I have. I created 3 tables and inserted some records on these tables. I write my query like this: But there a…
How do I fix the error that occurs when I enter the file path and date in mysqldump?
How do I fix the error that occurs when I enter the file path and date in mysqldump? I ran the mysqldump command as follows in cmd: set _my_datetime=%date:-=% mysqldump -u root -p –all-databases -pMyPassword > C:Program FilesMariaDB 10.4databackup%_my_datetime%.sql But the result is: I wonder how to …
Dynamic LIKE in WHERE clause in T-SQL with STUFF and FOR XML Path
What I’m trying to do is search a text column for anything LIKE anything in a list of values. The table with the text column is very large, so I can’t join on LIKE ‘%’ + valuename + ‘%’ (the list of values temp table is not terribly large). I thought I would try to do it th…
How can I select multiple columns while using “when” statement
Here is the syntax I wanted to use for “loan amount” column. I am creating a data set on ssas for reporting. But I am having a problem adding “loan id” column based on the syntax since I need both “loan amount” and “loan ID” in the same data set. How can integra…