473,686 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Perform a select statement to get lower values by id

15 New Member
Hi,

supposedly i have this table:
Expand|Select|Wrap|Line Numbers
  1. ID   Value
  2. 1     22
  3. 1     17
  4. 2     14
  5. 2     01
  6. 2     55
  7. 3     20
  8. 4     36
  9. 4     40
  10. 4     51
  11. 4     38
  12.  
and i want to select those records only:
Expand|Select|Wrap|Line Numbers
  1. ID   Value
  2. 1     17
  3. 2     01
  4. 3     20
  5. 4     36
  6.  
which means that i need the lowest values by id..

seems to be easy enough to accomplish, but i've gotten myself stuck on it...

thanks for any help
Aug 11 '10 #1
1 1196
ck9663
2,878 Recognized Expert Specialist
will a...

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT ID, MIN(Value) from YourTable Group by ID
  3.  
  4.  
work?

Happy Coding!!!

~~ CK
Aug 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
3514
by: Guy Hocking | last post by:
Hi there, I have a problem in my ASP/SQL Server application i am developing, i hope you guys can help. I have a ASP form with list boxes populated by SQL tables. When a user selects a value in a list box and submits the form the value is put into a session variable and the relevant page is displayed (in accordance to one of the list boxes). The page is then displayed with the relevant SQL data. So far i have got the
1
10070
by: avinash | last post by:
hi my self avi i want to copy data from one table to other table,by giving certain condition and i want o use insert statement .in this i want to pass some value directly and some value from select statement , if i try i ll get error i.e all column of destination table (i.e in which i want to insert data) should match with all columns in values column some thing like this. plz give me some helpful suggetion on this
10
7131
by: Antanas | last post by:
The problem is that when AddID is used multiple times in the same select statement, it returns the same value in all places. How could I force function AddID to increment OBJECTID sequence? Here is a basic sample of usage: SELECT AddID(), AddID(), AddID(), column1 from table1 Here is how AddID looks like:
0
1514
by: Michael Seele | last post by:
hi! i need a list of all primary keys in my database! for this reson i build these sql-statement: /SELECT pg_class.relname AS tableName, pg_constraint.conname AS pkName, pg_constraint.conkey AS columns FROM pg_catalog.pg_constraint INNER JOIN pg_catalog.pg_class ON pg_constraint.conrelid = pg_class.oid
1
2967
by: serena.delossantos | last post by:
Trying to insert into a history table. Some columns will come from parameters sent to the store procedure. Other columns will be filled with a separate select statement. I've tried storing the select return in a cursor, tried setting the values for each field with a separate select. Think I've just got the syntax wrong. Here's one of my attempts: use ESBAOffsets go
2
3173
by: bhanab | last post by:
Hello, Please can someone help me with this select statement? How do I get the statement to keep the week number static? ie if there are no values then it should show up as NULL, zero or just stay blank. This is the statment :-- Select a., b., c., d., e. From (SELECT Weeknum FROM .. Group by Weeknum)
3
4968
by: =?Utf-8?B?TWlrZSBD?= | last post by:
I have a SQL 2000 table named IMSRejects with the fields: IMSRejects.ProductDescription IMSRejects.VendorName IMSRejects.CatalogNumber IMSRejects.ProductIMS2Desc IMSRejects.CMA8Desc Many of the ProductIMS2Desc and CMA8Desc values are Null. I have an ASP.NET 2.0 web page which populates a datagrid with this data. I also have text boxes on my web page so users can filter the datagrid based on keywords. The problem I'm having is that the...
1
5032
by: anthonyjm | last post by:
I need to run a report for each record returned from a SQL Select statement. The report changes for each record, so they need to be run separately. So something like this (I have no idea what the syntax would be): strSelect = "SELECT field1, field2, field3 FROM table1 WHERE field4 = '1';" results = DoCmd.RunSQL strInsert foreach results AS result { DoCmd.OpenReport "LibraryCard", acNormal, "", "" }
1
20818
by: themightyrhino | last post by:
I'm writing a process to perform multiple updates on a main table from information stored in different component reports. As you can see from the below, I'm using a select query to base the update on. UPDATE DELTA_OD001_TMP TD SET (ORDER_DATE,VET_NO, VET_SCORE, VET_DECISION, PARTNER, ORANGE_ID) =(SELECT ORDER_DATE, VET_NO, VET_SCORE, VET_DECISION, PARTNER, ORANGE_ID FROM IMPORT_OD001_ORDERS IO WHERE TD.ORDER_NO = IO.ORDER_NO); ...
0
1354
by: DJN001 | last post by:
I need to perform a select statement that compares a literal to a timestamp.. like select * from table1 where timestampfld > 20100330
0
9057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8933
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8770
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7600
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6440
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2947
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2206
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.