Change SQL and all settings go back to the beginning

If I make a small changes in the SQL query it works fine, but if I add a sub-query for example, I then have to set all my settings for my fields again. How do you solve that?

Nothing to do, except redo your work

It happen regularly :frowning_face:

It happens to me as well. I just try to get all my queries written the way I want them before building the application on them. When I need to make a big change…I pull up my sleeves =)

Haha! True that! I hoped there was a better solution :slight_smile: But thank you for your reply!

Hi Zaz,
I also experienced this in the past. To avoid this situation nowadays I use subquery OR if it is a small SQL to begin with then use an alias. See below for example;

SELECT id,
name,
address
FROM employee

instead, write above as below with table alias

SELECT emp.id as id,
emp.name as name,
emp.address as address
FROM employee emp

OR

SELECT emp.id as id,
emp.name as name,
emp.address as address
FROM
(SELECT id,
name,
address
FROM employee) emp

See whether that helps with the issue you are experiencing now. with the second option, you can easily add JOIN statement or modify query later without affecting the app. But I know it is a longer SQL statement, but still better than losing all the work you have done. Unless someone else has a better solution

Thank you for your help!

There is one trick. Use Views in you Scriptcase queries.
Create a view and make changes to the view. So long as the field names do not change or you do not need some that you add it works great.

Second - if all you want to do is add new fields then you can add them to the end. That won’t affect the existing app. You just have to manually add them to your grid.

Third - any SQL conditions after the FROM is fine. ORDER BY, WHERE

It is one of the most frustrating things and small tweaks to a query can wreck hours of work that goes in to building the app. Particularly things like group by settings and refined search which all get ruined if you mess with the SQL query in Scriptcase.