skip to Main Content

Phpmyadmin – why multiply two column in sql is not equals to sum(column1 * column2)

if have these tables : orders(amount,unit_price,child_amount,child_price,service_id,issue_date,is_success) pools(name,for_view) services(id,pool_id) when i run this sql : SELECT SUM(orders.amount) AS totalAmount, SUM(orders.unit_price) AS totalPrice, SUM(orders.amount*orders.unit_price) AS total, SUM(orders.child_amount) AS totalAmountC, SUM(orders.child_price) AS totalPriceC, SUM(orders.child_amount*orders.child_price) AS totalC, pools.name, pools.for_view FROM orders INNER JOIN services…

VIEW QUESTION

Mysql – How to prevent decimal values entering in db?

-- Table: Cabin CREATE TABLE IF NOT EXISTS Cabin ( cabinID BIGINT AUTO_INCREMENT PRIMARY KEY, cabinType VARCHAR(150) NOT NULL, cabinDescription VARCHAR(255), pricePerNight BIGINT NOT NULL, pricePerWeek DECIMAL(10,2) NOT NULL, photo VARCHAR(50) ); INSERT INTO Cabin (cabinType, cabinDescription, pricePerNight, pricePerWeek, photo)…

VIEW QUESTION
Back To Top
Search