Subject | Rif: [firebird-support] Possible to use FIRST 1 inside a group by? |
---|---|
Author | Raffaele Confalone |
Post date | 2015-07-29T12:07:02Z |
This is solution:
select * from tabella A where Group_ID in (Select min(Group_ID) in tabella B
where B.ID=A.ID);
-------Messaggio originale-------
Da: Maya Opperman maya@... [firebird-support]
Data: 29/07/2015 13.49.41
A: firebird-support@yahoogroups.com
Oggetto: [firebird-support] Possible to use FIRST 1 inside a group by?
Hi,
Ive got quite a tricky SQL query (well, at least for me it is, Im hoping
someone may have done this before)
Heres a simplified example of what Im trying to do:
I have a table with
ID GroupID FKCode Value
1 1 ABC +5
2 1 XYZ -5
3 2 ABC +8
4 2 XYZ -8
5 3 ABC -2
6 3 XYZ +2
Id like to select the first record of each group, eg.
ID GroupID FKCode Value
1 1 ABC +5
3 2 ABC +8
5 3 ABC -2
Any ideas?
Thanks in advance
Maya
[Non-text portions of this message have been removed]
select * from tabella A where Group_ID in (Select min(Group_ID) in tabella B
where B.ID=A.ID);
-------Messaggio originale-------
Da: Maya Opperman maya@... [firebird-support]
Data: 29/07/2015 13.49.41
A: firebird-support@yahoogroups.com
Oggetto: [firebird-support] Possible to use FIRST 1 inside a group by?
Hi,
Ive got quite a tricky SQL query (well, at least for me it is, Im hoping
someone may have done this before)
Heres a simplified example of what Im trying to do:
I have a table with
ID GroupID FKCode Value
1 1 ABC +5
2 1 XYZ -5
3 2 ABC +8
4 2 XYZ -8
5 3 ABC -2
6 3 XYZ +2
Id like to select the first record of each group, eg.
ID GroupID FKCode Value
1 1 ABC +5
3 2 ABC +8
5 3 ABC -2
Any ideas?
Thanks in advance
Maya
[Non-text portions of this message have been removed]