how to write this sql

how to write this sql

  

I need to insert records in a table "DetailFeedbackTot" from "DetailFeedback", where the current date is = to DetailFeedback and
DetailFeedback.site is = to my local Variable SiteDescr used in my web form


Please help me with sql statement

Thanks



Hi Emanuela,

To take a step back, why use SQL at all? Why not an Aggregate? Aggregates are the preferred way of querying data.

Oh. 

I'm Learning to develop in outsytem, please suggest me the better way to do this.

Is it clear my need?

Emanuela Avanzi wrote:

Oh. 

I'm Learning to develop in outsytem, please suggest me the better way to do this.

Is it clear my need?

I recommend you do the courses first. Start with Becoming a Web Developer -> Developing OutSystems Web Applications. You will find all the necessary explanations about Aggregates. Or read Documentation here.


I'm with Paulo, if you haven't taken the courses and training you definitely should! Aggregates (and much more) will be explained in detail, so you're better able to write OutSystems software.

That said, Aggregates can't be used to insert records - something I overlooked in your question. If you regularly need bulk updates, SQL is indeed the way to go, but I would ask yourself why this is needed in the first place. Why do you want to move large amounts of data regularly from one table to another?

Becouse I've created a form with different images that each time you press on save data into a table ( directly)

but the user could also undo this task and decide not to save these records.

So I think to create a transition table where if user confirm I insert records into the tot table if user wants skip, i delete from this transition table and nothing save in tot table

I need definitily and "undo" action if possible.


Emanuela Avanzi wrote:

Becouse I've created a form with different images that each time you press on save data into a table ( directly)

but the user could also undo this task and decide not to save these records.

So I think to create a transition table where if user confirm I insert records into the tot table if user wants skip, i delete from this transition table and nothing save in tot table

I need definitily and "undo" action if possible.


You can create a flag, for example, to save the status of row. You don't need two tables to do this. So, just change the state of the flag, avoid having two tables for this.


Solution

Hi Emanuela,

That's definitely not how I would solve this. For example, you could have an additional Boolean Attribute that indicates whether the image is not yet confirmed, and when the user confirms, change the state (and when the user cancels, delete them). Another solution, if the "temporary" state of the images doesn't need to be persistent, why do you need to store it in the database at all? You could just keep them in a List in memory, only writing them to the database if the user confirms.

Solution

Damn Paulo, you ninja'd me again :).

Kilian Hekhuis wrote:

Damn Paulo, you ninja'd me again :).

Eheh :D