3 TABLES IN 1 VIEW

3 TABLES IN 1 VIEW

antoniocibantoniocib Posts: 201Questions: 41Answers: 1

Hi Guys i hope than you can help me!
I' ve 3 tables SQL but i want group this 3 table in a view
this is the pattern of tables is the same:

Table 1/2/3:

i want to make this result:

This only if the "IND" field is equal to 1, otherwise it must not add them in the view

CREATE  VIEW bologna AS
SELECT
scrivania1.ddt,scrivania2.ddt,scrivania3.ddt,
scrivania1.cliente,scrivania2.cliente,scrivania3.cliente,
scrivania1.carico,scrivania2.carico,scrivania3.carico,
scrivania1.destinazione,scrivania2.destinazione,scrivania3.destinazione,
scrivania1.pr,scrivania2.pr,scrivania3.pr,
scrivania1.scarico,scrivania2.scarico,scrivania3.scarico,
scrivania1.scarico_m,scrivania2.scarico_m,scrivania3.scarico_m,
scrivania1.data_di_scarico,scrivania2.data_di_scarico,scrivania3.data_di_scarico,
scrivania1.ind,scrivania2.ind,scrivania3.ind

FROM scrivania1,scrivania2,scrivania3
WHERE scrivania1.ind, scrivania2.ind, scrivania3.ind = "1"

Thanks all.

Answers

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    Would you want that table to also be editable with Editor? Or just a read-only DataTable?

    Colin

  • rf1234rf1234 Posts: 1,769Questions: 51Answers: 258

    If all of your 3 tables' definitions are identical I would use UNION ALL. This requires aliasing all of the columns to have identical names across all of the 3 tables. You'll find lots on this on Stack Overflow.

    But you would still need to answer @colin s question, I guess.

  • antoniocibantoniocib Posts: 201Questions: 41Answers: 1

    @colin and @rf1234 i want than that table is editable, i just use UNION ALL but in this way i cant edit the table

  • allanallan Posts: 52,636Questions: 1Answers: 8,053 Site admin

    Yes, unfortunately our Editor server-side libraries do not support direct UNION access. If your database allows INSERT/UPDATE/DELETE to be performed on your VIEW (I think some do, some don't - and even those that do probably have limitations based on what the VIEW is doing) then it would work with the libraries as is. But if not, unfortunately you'd need to write your own server-side code for the insert, update and delete actions.

    If you need to do that, the client / server data interchange for Editor is available here and I'm happy to answer any questions you have about it.

    Allan

  • antoniocibantoniocib Posts: 201Questions: 41Answers: 1

    Um, I don't even know how to start doing all this I thought that with Editor in a very easy way I could do it, being that not so programming I have to find another solution, thanks @allan for the arrangement.

Sign In or Register to comment.