Skip to content

Tag: sql

Get the final price with discount but only if column is not NULL. SQL

I use these sql tables with these columns: customers: id name phone adress etc.. 1234 Test Name Test Phone Test Adress etc data. orders: customerid orderid orderdate 1234 OR_1234 2022-1-1 orderitems: (in this table one customer can have multiple rows(items) id orderid productid 1 OR_1234 P1 products: productid productprice currency qty name weight P1 10 USD 1 TEST 0.2 KG

Hiding a button dependant on cell value in table

I currently have a table that data is being reported into with a few buttons at the end to perform actions (Consign, Unconsign, Edit, Delete). I’m trying to hide the Consign and Unconsign buttons for each row in the table depending on the Yes/No value a column. So far, I’ve managed to get the button Consign to hide if 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

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.

I wanna create a new table from the data of two tables

I have a A table to store the product name, the quantity and input day of goods in stock. In adverse conditions, invoices for the above products will be sent later. I will put the product name and invoice quantity in B table. The problem here is that I want to check the quantity of goods with invoice and without