Question

I'm trying to create a view through phpmyadmin. It contains some calculations. like

Select A,B,C,D,E, (IF(E>0,B,C)+A+D)

How am i able to do that?

Was it helpful?

Solution

Try this:

create view view_name -- provide an appropriate name for view
as 
select A,B,C,D,E, (IF(E>0,B,C)+A+D) as total
-- include from table if required
-- from my_table

Refer to:
MySQL: CREATE VIEW Syntax

CREATE
    [OR REPLACE]
    [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
    [DEFINER = { user | CURRENT_USER }]
    [SQL SECURITY { DEFINER | INVOKER }]
    VIEW view_name [(column_list)]
    AS select_statement
    [WITH [CASCADED | LOCAL] CHECK OPTION]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top