I need to remove all rows having duplicated title column. Something like: delete from clients where title is duplicated For example, if five rows have the same title column – four of them shold be …
I got mysqli error 1064 but i don’t know why
I want to post this data from android client and i tested it with postman and status code was 200. But i have a mysqli error and it’s: Error: ((1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘WHERE id=’ at line 1)
Can’t insert into database with save()
I am having an issue inserting a record into the database. I am a beginner with the Yii framework, so I may have made some stupid mistakes. This is from the SiteController public function …
SQL Window Function – Number of Rows since last Max
I am trying to create a SQL query that will pull the number of rows since the last maximum value within a windows function over the last 5 rows. In the example below it would return 2 for row 8. The …
Get the latest order_date after aggregation my rows
I have 2 tables: Customers table (which has a customer_id column) Orders table (which has customer_id and order_date columns) Is there a way to fetch all orders count for each customer with the …
Incorrect first value when using dense_rank with union all
I want to ‘batch’ my result (coming from a union of several queries) with a predefined ‘batch size’ but I can’t figure out why the first batch is always incorrect? For instance with the following …
How do I recursively find all matching rows in a table?
I’m trying to wrangle an existing database without resorting to tricks. I need to query within a linking table to find all matching id’s recursively. I’ve tried a number of nested join queries, but I’…
SQL Query to sum multiple count union queries
I have a statement with following structure, and I’m trying to sum all the count results. I have tried using the SUM function outside of the nested count queries combined using the same variable …
Join more than 2 database table in codeigniter Error : 1066
so i kinda new with codeigniter and im trying to join 3 table from my database database 1 : dkm (id, tgl, ref, etc) database 2 : order_product (kode_barang, packing, nama_barang, etc) database 3 : …
Creating dynamic query using jpa criteria
I created dynamic query using jpa criteria but an extra pair of parentheses gets added to columns to be selected when I do userGroupSubquery.select(userGroupsRoot); generated query select (…