I'm not quite sure why you want to get 3 for 046 if I count correctly there
are 4 different nro_invs
You may try the following query
Select CodeVet, Count(Distinct nro_invs)
From YourTable
Group By CodeVet.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to. " (Richard Branson)
"Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
gio.cot via MIDRANGE-L
Sent: Wednesday, 24 May 2023 20:07
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: gio.cot <gio.cot@xxxxxxxxxxx>
Subject: R: Help with Sql
Sorry .
I hope the table now is more clear
codeVet Year_Inv nro_inv type_inv
000 23 63509 G
046 23 71490 G
046 23 71490 H
046 23 75569 G
046 23 75978 G
046 23 76078 G
Hi all
Suppose i have a table with this data
codeVet
Year_Inv
nro_inv
type_inv
000
23
63509
G
046
23
71490
G
046
23
71490
H
046
23
75569
G
046
23
75978
G
046
23
76078
G
With Sql i would get :
The nro Invoice for every CodeVet_vet excluding the nro_inv the have two or
more row (in this case the nro_inv 23-71490) ; so the result that i would
need, is
CodeVet Nro_inv
000 1
046 3
Thanks in advance
Gio
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.