Viewing 15 posts - 3,226 through 3,240 (of 3,544 total)
Wanda,
Seems to me your code looks OK and matches your requirements. Maybe the problem is to do with data.
Try
SELECT LEDef_ActiveInd, LEDef_Cd FROM LEDef_PK WHERE LEDef_ActiveInd = 1
Do you get all...
Far away is close at hand in the images of elsewhere.
Anon.
June 24, 2003 at 3:26 am
Spot on Tim ![]()
Far away is close at hand in the images of elsewhere.
Anon.
June 24, 2003 at 3:14 am
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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?...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
June 19, 2003 at 7:24 am
Viewing 15 posts - 3,226 through 3,240 (of 3,544 total)