Viewing 15 posts - 3,226 through 3,240 (of 3,543 total)
Yes that was beginning to confuse me as well. It would be useful to know if
Case_no# can be in both Case30 and CASEOLDR?
Case30 has only one row per Case_no#
Case30 has...
June 23, 2003 at 10:35 am
Tim,
You can by doing the distinct in a sub query (as in my last post). However this relies on all the columns being duplicated, eg
Case_no#,Last_name,First Name,Determination,Sender etc...
1,Bloggs,Fred,Child,Master etc...
1,Bloggs,Fred,Child,Master etc...
however if...
June 23, 2003 at 10:17 am
Yes I also noticed what stax68 found and the outer joins could be your problem. However if you have true duplicates in both Case30 and CASEOLDR then this should do...
June 23, 2003 at 10:01 am
No need to apologise, it's nice to see my code challenged, keeps me on my toes and helps me write better code. I never write dynamic sql in procs unless...
June 23, 2003 at 3:36 am
The only thing I can think of is dynamic sql like this
declare @sql nvarchar(4000)
set @sql='select rowid'
select @sql=@sql+',max(case when caption='''+caption+''' then value else '''' end) as...
June 23, 2003 at 3:25 am
stax68,
Only 'belts & braces' and the way I always do it (bad habit maybe ). In the past I have had bad experiences with matching with nulls...
June 23, 2003 at 3:06 am
Ah! Thought that might be the case. Are u getting full row duplication or only a few columns? Can u be more precise as to what is duplicated? Which columns?...
June 23, 2003 at 2:47 am
There's more... Try the performance if this (remember the execution plan will be saved for this query in proc).
SELECTDISTINCT a.*
FROM(
SELECTCase30.Case_no#,
Case30.Last_name,
Case30.[First Name],
Case30.Determination,
Case30.Sender,
Case30.[Case Type],
Case30.Date,
Case30.[Qwik Due],
Case30.[Qwik sent...
June 20, 2003 at 8:23 am
In addition, if you want to get rid of case statements you could use
SELECT @where_clause = @where_clause +
ISNULL(@return+' AND Case_no# = '''+@param1+'''','')+
ISNULL(@return+' AND last_name...
June 20, 2003 at 8:02 am
What duplicates are you getting, from one of the selects or when they are combined. If when combined then you could try
select distinct a.* from (select... union select...) a
June 20, 2003 at 7:51 am
Assuming two rows per id,one value numeric, one char and no char value startswith number
then
select a.rowid,a.value,b.value from test a
inner join test b on b.rowid = a.rowid and ascii(b.value) > 57
where...
June 20, 2003 at 7:35 am
With the number of id's you are suggesting, I don't think there is an easy way. As already mentioned above the use of IN should be avoided. Passing the list...
June 20, 2003 at 7:16 am
SELECT TOP 100 PERCENT
ISNULL(d.UDL4, 'Unknown') AS WSI,
COUNT(d.DataID) AS QCount,
MAX(x.QDefectCount) AS 'QDefectCount',
MAX(x.DefectSum) AS 'DefectSum'
FROM Defect_Data d
INNER JOIN (SELECT ISNULL(UDL4, 'Unknown') AS WSI,
SUM(CASE WHEN SUMDEFECTS > 0...
June 19, 2003 at 7:24 am
Don't know as my db's are case-insensitive anyway. However did find this snippet in BOL
Note The full-text search queries behave in a case-insensitive manner for those languages (mostly Latin-based) for...
June 19, 2003 at 6:58 am
Viewing 15 posts - 3,226 through 3,240 (of 3,543 total)