A situation arose where I have to heuristically find out a table name from a common id. The tables have the same exact structure so I thought union or union all will work as suggested by some answers here. The problem is, applying a limit clause to the query is not working well. If I apply it on more than
Tag: sql
Missing required parameters for [Route: photographers.edit] [URI: posts/edit/{photographers}]
I Get this error every time I create an edit button or even a button to view a particular post in my project. Here’s my route code: Here’s my edit function in the controller file : Here’s my view button route: I read a lot of previous posts on this issue but didn’t really help me. Answer sometimes the dependency
How to create VIEW witch combined and filtraded result from multiple rows
Hi i have problem with task i need to do. I have a table in SQL showing log of users (subscibers) with triggers that add TIMESTAMP, ACTION PERFORMED and NAME of the subscriber, looks something like this: TABLE: audit_subscibers ID Name Action Time 0 John Insert a subscriber 2020-1-1 1 John Deleted a subscriber 2020-3-1 2 Mark Insert a subscriber
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
AWS does not load PHP webpage wherever I try to connect to database
I’m new to AWS and I’ve tried deploying my web application but keep getting 504 Gate-way Timeout. However, after a bit of debugging and redeploying, I noticed that this was being caused by the PHP segment of my index.php file: In particular when I removed everything before the session_start(); line, the webpage was able to load, although it was with
Creating an auto incremented id when user submits a form
Currently I have a refno. column in my database with the format LP00001. Now I have a add page that inserts all data that the user inserts in the input field and all this data gets sent to a table in my database, but my refno column stays null which I want to have an auto incrementing value where the
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.