|
-
Mar 20th, 2000, 06:43 AM
#1
Thread Starter
Hyperactive Member
These are two fields of more, of three records of my table (for example):
RECORD 1:
field1 = x
field2 = y
RECORD 2:
field1 = x
field2 = z
RECORD 3:
field1 = x
field2 = y
I want a recordset where field1 = x but, not repeat the value of field 2. This is, the recordset must have just two records, the record 1 and 2 (or 2 and 3).
I tryed this sql sentence:
SELECT * FROM table WHERE field1 = 'x'
But get 3 records.
What would be the correct sentence?
-
Mar 20th, 2000, 03:19 PM
#2
New Member
You need to add a grouping statement to your SQL stmt. I used a table called Table 1, added the two fields and used the following SQL stmt to get the results you wanted. Hope this helps.
SELECT Table1.Field1, Table1.Field2
FROM Table1
GROUP BY Table1.Field1, Table1.Field2;
-
Mar 20th, 2000, 09:53 PM
#3
Member
or
"Select distinct field2"
"from table"
"where field1=x"
keep in mind that this recordset will only allow you to access field2, however, since you queried on field1, you already know that it is x!
-Elias
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|