PROBLEM WITH SQLITE - View with multiple selects

1

I have three tables that I have to take a die in each to make an algorithm in the app, but I would like to know if I have a view that brings me the three data that are in the tables. I would like to know if I have to do this because none of the tables are related, so a JOIN is not possible.

But if a select does not return anything "0 row (s) affected" it does not bring any of the other tables, could it put a default value? so that the result of the others brings even one of them does not bring any value

The select's to be made are these:

SELECT PrecoBase FROM tbPRECOBASE WHERE Warehouse_Origem = "1" AND Numero_Item = "g";
SELECT * FROM tbPDISC WHERE Division = "BOV" AND Customer = "0" AND Customer_Type = "VD" AND Item_Number = "s" AND date('now') BETWEEN Date_Start AND Date_Finish;
SELECT * FROM tbPDISCQT WHERE tbPDISCQT.Numero_Item = "D53510B" AND 71>=CAST(tbPDISCQT.Quantidade_Inicial AS INTEGER) AND Tipo_Cliente = "JOS" AND DATE('NOW') BETWEEN Data_InicialData_Final; 
  

Note: by the rule always the tbPRECOBASE table will bring some result, the others will not always.

    
asked by anonymous 17.04.2014 / 14:27

1 answer

2

It is possible to create views, see the official SQLite link.

And here > a similar SOEN issue.

Example:

/* criar a view */
CREATE VIEW VIEW1 AS
SELECT T1.*, T2.*, T3.* FROM TABELA1 AS T1, TABELA2 AS T2, TABELA3 AS T3

/* executar a view */
SELECT V1.* FROM VIEW1 AS V1
  

It is not necessary to have any links between tables, to use them, in VIEW , although this does not seem to have much logic.

    
17.04.2014 / 14:34