Dunce's question ...
Is there a SQL equivalent of the following steps which I would take using foxpro:
If I wish to get a value from a row in a table and insert it into another table/manipulate it/update something etc. I would select the table and locate the record that I wished to look at (using a "locate for ... " command). If I find it, the record pointer is on that row, so I can now reference the values of the fields using simple dot notation such as
thisvar = mytable.myfield
replace othertable.otherfield with mytable.myfield
and so on. I know that if I refer to the first table it is still looking at the same record unless I take other steps to move. I can refer to any field within that row to perform calculations and so on.
A lot of the SQL syntax uses selects to pull the value of a field - such as:
set @newvar = (select field from table where criteria)
Now, every bone in my body is screaming that I do not want to run a select query each time I need to reference a field's value, for performance alone. Is there another way to do this without selects? Am I right to question this or am I simply applying incorrect logic to this new language?
I don't have any objections to using the selects, but I can't help but feel that at this early stage of development that I must learn these fundamentals correctly.
Thanks a lot Derren
[Mediocre talent - spread really thin]
Is there a SQL equivalent of the following steps which I would take using foxpro:
If I wish to get a value from a row in a table and insert it into another table/manipulate it/update something etc. I would select the table and locate the record that I wished to look at (using a "locate for ... " command). If I find it, the record pointer is on that row, so I can now reference the values of the fields using simple dot notation such as
thisvar = mytable.myfield
replace othertable.otherfield with mytable.myfield
and so on. I know that if I refer to the first table it is still looking at the same record unless I take other steps to move. I can refer to any field within that row to perform calculations and so on.
A lot of the SQL syntax uses selects to pull the value of a field - such as:
set @newvar = (select field from table where criteria)
Now, every bone in my body is screaming that I do not want to run a select query each time I need to reference a field's value, for performance alone. Is there another way to do this without selects? Am I right to question this or am I simply applying incorrect logic to this new language?
I don't have any objections to using the selects, but I can't help but feel that at this early stage of development that I must learn these fundamentals correctly.
Thanks a lot Derren
[Mediocre talent - spread really thin]