|
No luck, we are on V7R1 :-(
On Mon, 23 Nov 2020 at 21:00, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
take a look at LISTAGG()...the
select customer, listagg(distinct type concat ':' concat code
, ','
) within group (order by type. code)
from mytable
group by customer
returns a VARCHAR...
change DISTINCT to ALL if you don't need to remove duplicates.
I was wondering if such a list would be helpful...
Charles
On Mon, Nov 23, 2020 at 11:10 AM Dave <dfx1@xxxxxxxxxxxxxx> wrote:
I read that in a CLOB one could save, for example an employee's resume.So
I thought that you could detect if one resume was identical to anotherwith
select distinct myclobcolumn. I was hoping I could save each list oflines
of a customer as a CLOB.
Don't need to do any calculations with the amounts, just need to know
grabdifferent combinations of column values and number of lines.wrote:
On Mon, 23 Nov 2020 at 17:49, Charles Wilt <charles.wilt@xxxxxxxxx>
want
Still not clear what you want to do...
If two customers have the same distinct set of type/codes, you only
toupdate...
see the first customer?
Not sure how such a list helps with your actual requirement to
any
Seems to me that you'd want amounts involved and you'd want to see if
total?customers with the same distinct set of type/code have a different
Id.
Charles
On Mon, Nov 23, 2020 at 9:16 AM Dave <dfx1@xxxxxxxxxxxxxx> wrote:
Yes, that's it! Customer number has nothing to do with combination
Imagine all my money fell out of my pocket and everyone tried to
tocents,what
he could. One might have 1 10 cent coin, another 5 cents and 20
That'stwo
others managed to pick up a 50 cents, a 20 cents and a 2 cents.
4are
people but only 3 exact combinations of coins with the same value.
@Niels, if I add the line (4, 'T1', 'CX') to your table "a", there
now
4 distinct lists but your select statement still returns 3.
A bit more background in case anyone is wondering why I would want
wrote:dothe
data.this: we need to update a large file containing insurance garantie
Each line with a type and code and an amount is a component of the
garantie. Two customers with exactly the same number of lines with
makesame
corresponding combinations of type and code (I left out amount to
it
insured.simpler) effectively have the same garantie for the same object
Weorder
need to identify the different garanties that exist in this file in
thatto update it accordingly.
Just a thought, I've never used a CLOB before, but I'm wondering if
would do it?
On Fri, 20 Nov 2020 at 20:32, Charles Wilt <charles.wilt@xxxxxxxxx
wrote:
Ok, so if a later customer has the same (exact?) distinct set of
(type,code),
then don't need that customer included?
Charles
On Fri, Nov 20, 2020 at 10:13 AM Dave <dfx1@xxxxxxxxxxxxxx>
Nov.Therecombinations
I'm sorry everyone, what I wrote was confusing :
In my table below there are 4 customers but only 3 distinct
of
Type and Code.
There are more than 3 distinct combinations of type and code.
tryare 3
distinct lists. Customers 1 and 4 have the same list.
Niels understood correctly although it didn't work for me, I'll
again
to make sure
Niels Liisberg <nli@xxxxxxxxxxxxxxxxx> schrieb am Do., 19.
thisgroup2020,
18:37:
OK - Just my understanding - in that case : min(custno) ..
by
..
joepluta@xxxxxxxxxxxxxxxxx>approach is much cleaner of course
On Thu, Nov 19, 2020 at 6:28 PM Joe Pluta <
wrote:
I don't see where he says that, Niels. He just provides
Ias a
result:
combination Type Code
1 T1 C1
1 T1 C2
2 T2 C3
2 T2 C4
3 T5 C1
The "combination" in this example is the customer number.
askingwordsdon't
see
what else it could be, so perhaps Dave can chime in with
toset,
tell
us
what's supposed to be in that first column.
On 11/19/2020 11:19 AM, Niels Liisberg wrote:
@Joe - He is not asking for the first customer id in the
inheother
is
asking
for the combination number..
So therefore customer number is out of the equation.
This works and gets your "combi" column right whereas the
providesolutions
fake it by doing magik with the customer number.
... However ,my solution is nowhere near beautiful.
Here "a" is just your input data so for that, your just
your
ownjoepluta@xxxxxxxxxxxxxxxxx>
table :
with a ( cust , typ , code) as ( values
(1,'T1','C1'),
(1,'T1','C2'),
(2,'T2','C3'),
(2,'T2','C4'),
(3,'T5','C1'),
(4,'T1','C1'),
(4,'T1','C2')
) , b as (
select typ , code
from a
group by typ , code
) , c as (
select row_number() over () as combi , typ
from b group by typ
)
Select combi , b.typ , b.code
from b join c on b.typ = c.typ;
Gives:
Combi, Typ, Code
1 T1 C1
1 T1 C2
2 T2 C3
2 T2 C4
3 T5 C1
On Thu, Nov 19, 2020 at 5:40 PM Joe Pluta <
wrote:
That's why I tend to ask my customers to try and explain
words
what
they want. For this request, it SEEMS that Dave is
type,customerfor a
list
of
all the unique type/code combinations and the first
codewhere
they
appear. This is:
select min(cust), type, code from table group by type,
type,order
by
type, code
Which is what Mitch provided.
On 11/19/2020 9:32 AM, Charles Wilt wrote:
if the count is immaterial...why include it?
select distinct type, code
from table
But the OP isn't looking for just the list of distinct
combinationscodes...he
wants a list where the customers with those distinct
are
bczopek@xxxxxxxxxxxxxxx>"somehow" included.
The "somehow" isn't very clear to me.
Charles
On Thu, Nov 19, 2020 at 8:17 AM Bob Czopek <
permutations...wrote:
Real life SQL Brain teaser (Dave)
Your question is how do I get distinct type and code
Select type, code, count(*)
From table
Group by type, code
Order by type, code;
The count is immaterial, you get all type distinct
the----------------------------------------------------------------------code
combinations...
message: 1
date: Thu, 19 Nov 2020 14:30:24 +0100
from: Dave <dfx1@xxxxxxxxxxxxxx>
subject: Fwd: Real life SQL Brain teaser
Charles,
That?s amazing but it?s not quite there. If I select
Ilines
where
rownbr = 1, I eliminate the list from customer 3, but
MIDRANGE-L@xxxxxxxxxxxxxxxxxxalsonot
lose
the
first
line from customer 2
cust type code ROWNBR
1 T1 C1 1
1 T3 C2 1
2 T1 C1 2
2 T2 C3 1
2 T3 C4 1
3 T1 C1 3
3 T2 C3 2
3 T3 C4 2
Thanks to everyone else for trying whose solution did
work !(MIDRANGE-L)
End of MIDRANGE-L Digest, Vol 19, Issue 1670
********************************************
--
This is the Midrange Systems Technical Discussion
mailing
list
To post a message email:
withwitharchiveshttps://lists.midrange.com/mailman/listinfo/midrange-lTo subscribe, unsubscribe, or change list options,
visit:
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
subscriptionat https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any
related
questions.
Help support midrange.com by shopping at amazon.com
archivesour(MIDRANGE-L)
affiliate
--link: https://amazon.midrange.com
This is the Midrange Systems Technical Discussion
https://lists.midrange.com/mailman/listinfo/midrange-lmailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
subscriptionat https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any
related
questions.
Help support midrange.com by shopping at amazon.com
ourour(MIDRANGE-L)
affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion
https://lists.midrange.com/mailman/listinfo/midrange-lmailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
subscriptionor 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
related
questions.
Help support midrange.com by shopping at amazon.com with
(MIDRANGE-L)affiliate
link: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion
https://lists.midrange.com/mailman/listinfo/midrange-lmailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
subscriptionsubscriptionor 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
mailingrelatedaffiliate
questions.
Help support midrange.com by shopping at amazon.com with our
link: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
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
mailingmailingmailingrelatedaffiliate
questions.
Help support midrange.com by shopping at amazon.com with our
link: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
affiliatelistrelated
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
questions.
Help support midrange.com by shopping at amazon.com with our
link: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
affiliatelistrelated
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
questions.
Help support midrange.com by shopping at amazon.com with our
link: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
affiliatelistrelated
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
questions.
Help support midrange.com by shopping at amazon.com with our
relatedlistlink: https://amazon.midrange.com--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
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
listquestions.--
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
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.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
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.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.