SQL Script

Tried to edit an SQL script that was provided but one of the variables $currentAssignedItems, keeps returning ? This was after my DB changed from one table broken down into several so probably the wrong field name somewhere but due to a lack of understanding I'm having trouble. I don't really understand the set field part in the loop and secondly does scripting with executeSQL allow you to just specify fields without having the table prefix beforehand even for fields in different tables?

[D]oes scripting with executeSQL allow you to just specify fields without having the table prefix beforehand even for fields in different tables?

No SQL query allows you to bypass specifying table names, with the exception that you can omit them if all the fields in the query come from the same table. I usually use table aliases to make the queries shorter and easier to read, like this:

Of course, if you are coming from different tables, then you have to create a join between them in the query. You can do this either explicitly or implicitly. The latter is simpler, but only works for simple joins (like where there are only two tables). That might look something like this:

If you need additional tables included, it usually gets a bit more complex. We would need to see your table structure to know how to help.

Mike

P.S. It's usually better to post your screen shots as images (little camera icon) rather than sticking them in a Word document. That way, people can see the image without having to download and open the document.

[D]oes scripting with executeSQL allow you to just specify fields without having the table prefix beforehand even for fields in different tables?

No SQL query allows you to bypass specifying table names, with the exception that you can omit them if all the fields in the query come from the same table. I usually use table aliases to make the queries shorter and easier to read, like this:

Of course, if you are coming from different tables, then you have to create a join between them in the query. You can do this either explicitly or implicitly. The latter is simpler, but only works for simple joins (like where there are only two tables). That might look something like this:

If you need additional tables included, it usually gets a bit more complex. We would need to see your table structure to know how to help.

Mike

P.S. It's usually better to post your screen shots as images (little camera icon) rather than sticking them in a Word document. That way, people can see the image without having to download and open the document.