all groups > sql server programming > may 2007 >
You're in the

sql server programming

group:

Query


Query vanitha
5/20/2007 10:45:00 PM
sql server programming:
Hi,

I have 3 tables Scheduled, parameters, parametervalues. help me to identify
duplicate scheduled instances. To be a duplicate all of the following must
be the same:

RID (ReportID)
Delivery Method (PDF or Excel)
Frequency
All parameter values must be identical

the delivery method and the frequency for the particular RID is stored in
the Scheduled table. so there is no problem with these 2 columns.

for the parameter values the data is stored in the parameters and
parametervalues table. these 2 tables are joined using Scheduled table.

example

Scheduled

id report_id delivery_method freq_id
555 95 2 2
560 95 2 2
565 96 2 2
566 96 2 2

Paramerters

id report_id param_name
107 95 @loc
108 95 @Cust
110 96 @Cust
111 96 @Vendor

Parametervalues

id param_id sched_id param_value

1361 107 555 REPUBLIC TITLE DALLAS
1362 108 555 HUD TX
1381 107 560 REPUBLIC TITLE DALLAS
1382 108 560 HUD TX
1111 110 565 HUD CO
1112 111 565 Sample
1113 110 566 HUD CO
1114 110 566 Sample2

the parametervalues.param_id = parameters.id and parametervalues.sched_id =
scheduled.id

now i want to find out if all of the parameter values must be identical. now
in this case for report_id = 95 the 2 different schedules(555,560) the param
@loc is same i.e "REPUBLIC TITLE DALLAS", and the second param @Cust = HUD TX
is same. so the 2 schedules are same i.e. duplicate.

but in the case of report_id = 96, the param @vendor is different for 2
schedules... so it not a duplicate.

please help me to find out the duplicate.

Thank you
Re: Query Uri Dimant
5/21/2007 12:00:00 AM
Hi
I hope it will give you an idea.
http://dimantdatabasesolutions.blogspot.com/2007/02/dealing-with-duplicates.html





[quoted text, click to view]

Re: Query vanitha
5/21/2007 2:16:02 AM
thanks for you reply.

here in my problem i am using 2 table to compare their values to find the
duplicates. number of parameters(param_id) for each report may vary. so i
can't put the fixed where clause.



[quoted text, click to view]
AddThis Social Bookmark Button