CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    74

    sql server ce query question

    hi,
    i have two tables
    products that have the name and code and stock_products that have the
    current stock

    and i want in a single query see the especific value of the table stock_products
    for example

    from table one: code of product and from table two the stock of the
    product

    in secund table i have many records that belong for the same product
    but i want only the last record

    now the great question
    how can i do that?
    thanks a lot for your help

    i using sql server ce

  2. #2
    Join Date
    Dec 2009
    Posts
    596

    Re: sql server ce query question

    I've never worked with CE so I don't know if this will work. If your Primary Key is of identity type then see if you can incorporate this in you statement.

    Code:
    SELECT * 
    FROM    TABLE
    WHERE   ID = (SELECT MAX(ID)  FROM TABLE)

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: sql server ce query question

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured