Skip to content
Advertisement

Tag: sql

Change value of returned PDOStatement [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 11 months ago. Improve this question I have a function getMaxID, which queries a database (messages) and gets the maximum id I want to change the value name of the only

PHP How to orderby two columns when the data is equal

This return come from this query. Let`s understand my doubt, i have this data. When i have the equal points data 0 is 120 and data 1 is 120. I need to display the first data with less totalTime in this case needs to be like this : Can i manage this only with SQL or i need to order

Laravel – query to join tables in Many to many relation

I have the below tables posts – id – name categories – id – name category_post – post_id – category_id Post.php Category.php A post may contain many categories. I want to query all posts related to the categories of any given post in the least number of database queries. For example, If a post belongs to three categories, I want

Prepared Statement does not use expected index

I have a very large table of IOT sample that I’m trying to run a relativly simple query against. Running the query normally using the MySql CLI returns a result in ~0.07 seconds. If I first prepare the query either via PDO or by running a SQL PREPARE statement then the request takes over a minute. I’ve enabled the the

How to update a column by joining four tables in laravel

I have four tables default_products_product_mileage_gap default_products_mileage_gap default_products_products default_products_products_mileage_gaps I am trying to update a column number_of_products_sold to some value using laravel What I have tried is: Here number_of_products_sold is not updating. How to update the column Answer Why you want to add four table together. here is an example to add or update multiple table from by controller.

Advertisement