Hi! Could we please enable some services and cookies to improve your experience and our website?
No, thanks.
Okay!
SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
CREATE VIEW ocp_transaction_ReceiptData AS SELECT MasterTransaction_0.IDNumber AS ReceiptNo, MasterTransaction_0.ID, MasterTransaction_0.eftposReceiptNumber, coalesce(sum(CASE WHEN to_items_1.to_itemType_code = 'SURCHARGE' THEN to_items_1.paymentAmount ELSE 0 END), 0.0) AS surchargeAmount, coalesce(sum(CASE WHEN to_items_1.to_itemType_code != 'SURCHARGE' THEN to_items_1.paymentAmount ELSE 0 END), 0.0) AS NetAmount, MasterTransaction_0.createdAt AS CreatedAt, MasterTransaction_0.totalAmount AS TotalAmount, to_counter_2.description AS CounterDesciption, to_agent_3.agentID AS AgentID, to_counter_2.code AS CounterID, MasterTransaction_0.to_agent_ID FROM ((((ocp_transaction_MasterTransaction AS MasterTransaction_0 LEFT JOIN ocp_transaction_PaymentItem AS to_items_1 ON (to_items_1.to_masterTransaction_ID = MasterTransaction_0.ID)) LEFT JOIN ocp_config_business_counter_Counter AS to_counter_2 ON MasterTransaction_0.to_counter_code = to_counter_2.code) LEFT JOIN ocp_config_user_management_Agent AS to_agent_3 ON MasterTransaction_0.to_agent_ID = to_agent_3.ID) LEFT JOIN ocp_transaction_Receipt AS to_receipt_4 ON (to_receipt_4.to_transaction_ID = MasterTransaction_0.ID)) GROUP BY MasterTransaction_0.ID, to_counter_2.description, to_agent_3.agentID, to_counter_2.code, to_receipt_4.content;
SQL
Server:
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
MySQL 9.3.0
MariaDB 11.4
MariaDB 11.8
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
SQLite 3
SQLite 3 Preloaded
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
PostgreSQL 16
PostgreSQL 17
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear