472,353 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

first value of each itemid how ?

hi,
From below table want only the first value of each item id.

and how to get it, tried to use top n function in select statement
it takes only the first record.

itemid qty
1 10
1 5
1 15
2 20
2 15
4 10
4 5
4 2

How to get first record of each item only.

captain

Nov 13 '05 #1
2 1665
ca**********@yahoo.com wrote:
hi,
From below table want only the first value of each item id.

and how to get it, tried to use top n function in select statement
it takes only the first record.

itemid qty
1 10
1 5
1 15
2 20
2 15
4 10
4 5
4 2

How to get first record of each item only.

captain


If your ItemID records have an autonumber, I would create a query
(Query1) that selects the ItemID and Qty and sort on ItemID,
ItemIDAutoNumber. That way the query will sort the records in the order
they were entered. Then create a Totals query using Query1, group on
the ItemID and select First for qty.

Access does not necessarily open up a table in sequential mode. So you
may end up with a First that may not be the first. Hopefully by
ordering it first by the authonumber you would get the true First entry.
Nov 13 '05 #2
Might try using the Max(qty).
Turn the Aggregation tool on. By default all fields selected will have
"Group By" on, change this to Max for the qty field.
SQL would look like
SELECT itemid, MAX(qty) as MaxOfqty
FROM tablename
GROUP BY itemid

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sparky Arbuckle | last post by:
Dim MyCookie as new httpCookie(myCookieName) FOR EACH myItem as DictionaryEntry in htCart myCookie.Values(myItem.Key) = myItem.Value Dim...
3
by: webserverpete | last post by:
I am new to ASP.NET in general, but I do have experience with classic ASP. I am using a DataList control with a hidden value to submit to a...
1
by: Slonocode | last post by:
I have a collection of objects in a hashtable. The objects have a datamember that is empty. I need to loop through the items in the hashtable...
1
by: kb222 | last post by:
This is probabally more simpler than I am making it but all I am trying to do is count the number of recrods in a child table where my IteimID...
2
by: zb | last post by:
Scenario: I have a datalist control bound to a datasource. By itself, this works just fine. Now, inside the ItemTemplate I have a custom user...
0
by: Richard | last post by:
A container holds items that can be arranged by a person. A container may contain only one of a given item. Containers ----- ContainerId...
0
by: =?ISO-8859-2?B?UmFmYbMgR2llemdhs2E=?= | last post by:
I have: protected void InitControls() { gvProfile.AutoGenerateColumns = false; DataTable dtProfile = new DataTable("KFS"); // dodajemy...
2
by: sunilkes | last post by:
Hello, I have a table ItemID Version 12 1.0 12 1.1 12 2.0 13 2.0
0
by: rajesh0303 | last post by:
Iam get null values in the datakeynames AlertID,ItemID while executing the Insert Command....I am Inserting using Externel button Event.Here is the...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.