Re: Multiple Statements in a query



Ivan Marsh wrote:
On Fri, 02 Mar 2007 11:28:02 -0800, paladin.rithe@xxxxxxxxx wrote:

I have 2 statements that I'd like to string together in a query, but
according to everything I'm seeing, it's not possible.
What I'm doing is an insert of a row, where the primary key is an auto
increment. I want to retrieve that by using LAST_INSERT_ID(). I
tried sending another query after the first (once I knew that it the
data was what I need) but it didn't return anything. It seems that
that function can't be used in separate calls or something. Either
that or there's a setting that I need to check. Any ideas?

If you're trying to return the last inserted row on a table with an auto
increment field all you have to do is query the maximum value in that
field.


And if you have two people insert at the same time one is going to get the wrong value.

A terrible way to do it!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: Multiple Statements in a query
    ... tried sending another query after the first (once I knew that it the ... If you're trying to return the last inserted row on a table with an auto ... increment field all you have to do is query the maximum value in that ...
    (comp.lang.php)
  • MAX() operator with auto number field
    ... In this case, job_id is an auto number field of the job table, and its ... primary key. ... I built the query interactively using the Query grid. ...
    (microsoft.public.access.queries)
  • Re: can you specifie criteria for a parameter query in an Auto Number.
    ... >I have created a parameter query, and specified criteria in an Auto Number ... >field (which is also the primary key) and when i run the query i get no ...
    (microsoft.public.access.queries)
  • Re: Problem with Access concatenate query
    ... records in the final query. ... You probably need to INNER JOIN the tables, although on what column, I am not sure. ... PriceID -- Primary Key ... ItemID --- Foreign Key ...
    (microsoft.public.access.queries)
  • RE: Processing thousands of records
    ... Jerry Whittle, Microsoft Access MVP ... Access automatically creates an index for primary key fields. ... that the query is working faster, you don't need the 1stVisit02 query. ... where do I read about fundamental indexing and normalization? ...
    (microsoft.public.access.queries)