SQL question

hershbp at verizon.net hershbp at verizon.net
Sun Jul 11 15:37:01 CDT 2004


On Sunday, July 11, 2004, at 04:07 PM, Andre Garzia wrote:

>
> Hershel,
>
> since you're doing the INSERTS you have access to the inserted data, 
> can't your refine your SELECT query so that you SELECT WHERE and put 
> all the inserted data as refinements, this way you'll retrieve the 
> correct record. Thats what I use here.

I don't think this will work in my case because basically what I'm 
inserting is just any piece of info e.g. the time  to create a new 
record (in an e.g.sales table ). The db auto creates a pk , then I need 
to take this pk from the sales table and insert it for a fk in a 
line_items table to have all line items (every transaction related to 
its sale number ) and then I take out the fk from the line_items 
(SELECT") and go back to the sales_db add the sales amount to the db 
with an "ALTER db SET sale_amount ='xx.xx' WHERE pk_auto = 'thepk'
Sales_db , pk_auto, sale_amount,date,time
Line_items_db, item_name,item_price,sales_fk
Thanks , Hershel

>
> Cheers
> andre
>
>
> On Jul 11, 2004, at 4:48 PM, hershbp at verizon.net wrote:
>
>> HI ,
>> How do I "INSERT" A SQL statement and return some of  the record or 
>> field info  immediately ?
>> I'll try to elaborate. A database app. running many clients, I create 
>> a new record and want to get the primary key of that newly created 
>> record. If I'll do an "INSERT" and then go the last record via 
>> "SELECT" then between the INSERT and the SELECT somebody else from a 
>> different location can insert a new record then when I do the select 
>> to get the last as mentioned above I'll get the wrong pk. How do I 
>> overcome that ?
>> Thanks , Hershel.
>>
> -- 
> Andre Alves Garzia  2004  BRAZIL
> http://studio.soapdog.org
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
  
  


More information about the use-livecode mailing list