Showing posts with label numbers. Show all posts
Showing posts with label numbers. Show all posts

Wednesday, March 28, 2012

Grouping on first 2 characters of a number

Well, here I am again needing help. :(

My report shows a long list of numbers and I want to separate them into groups based only on the first two characters of each number. For example:

3102
3106
3103

3201
3203
3204

3506
3504
3508
3509

How do I tell Crystal to look at only the first 2 characters and sort accordingly, keeping all the "31" "32" and "35" together? My report is based on a stored procedure so I cannot change the number into a string.

Thank you!!!make a formula in crystal report with Left(cstr(Number field) ,2) and in groupby instead of number use this formula|||Thank you so much! That was it!!!

Grouping numbers

I have a table which lists player names, teams played for and the
years they played there and my code looks like this

SELECT AlsoPlayedFor.playerID, AlsoPlayedFor.teamID,
AlsoPlayedFor.TeamName, Min([AlsoPlayedFor].[Year]) & "-" &
Max([AlsoPlayedFor].[Year]) AS [Year]
FROM AlsoPlayedFor
GROUP BY AlsoPlayedFor.playerID, AlsoPlayedFor.teamID,
AlsoPlayedFor.TeamName;

which takes the Min year and the Max Year and displays it like "Year-
Year"

But lets say for example the player played for 5 years so it 1990,
1991, 1992, 1993, 1995

It would display as 1990-1995 but I want it to display as 1990-1993,
1995, is this possiable? Also I need it to gothe other wayso if the
years are 1990, 1992, 1993, 1994, 1995 I want that to display as 1990,
1992-1995.

PLEASE HELPChris (chrislabs12@.gmail.com) writes:

Quote:

Originally Posted by

I have a table which lists player names, teams played for and the
years they played there and my code looks like this
>
SELECT AlsoPlayedFor.playerID, AlsoPlayedFor.teamID,
AlsoPlayedFor.TeamName, Min([AlsoPlayedFor].[Year]) & "-" &
Max([AlsoPlayedFor].[Year]) AS [Year]
FROM AlsoPlayedFor
GROUP BY AlsoPlayedFor.playerID, AlsoPlayedFor.teamID,
AlsoPlayedFor.TeamName;
>
which takes the Min year and the Max Year and displays it like "Year-
Year"
>
But lets say for example the player played for 5 years so it 1990,
1991, 1992, 1993, 1995
>
It would display as 1990-1995 but I want it to display as 1990-1993,
1995, is this possiable? Also I need it to gothe other wayso if the
years are 1990, 1992, 1993, 1994, 1995 I want that to display as 1990,
1992-1995.


I could suggest a query which in SQL 2005 at least give you a comma-
separated list of the years. Collapsing adjacent years into ranges appears
to make things a lot more complicated.

However, the query you posted has syntax which is not legal in SQL Server,
but has a touch of Access, a product of which I have no experience.

Could you clarify which product and which version of that product you
are using? If you are using Access, I recommend that you try an Access
newsgroup instead.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.

What you posted implies a serious design error about history tables.
What you are askimg for is a violaiton of 1NF and the principle that
display is done in the front end and never the backend in a tiered
architecture. And finally the syntax you posted is not valid.

Want to try again?|||Erland Sommarskog wrote:

Quote:

Originally Posted by

>
>
I could suggest a query which in SQL 2005 at least give you a comma-
separated list of the years. Collapsing adjacent years into ranges appears
to make things a lot more complicated.


Here is a recursive solution that will do the job when
MAXRECURSION is no greater than the number of separate
years for one individual player. Some of the complication
is to get around limitations in what a recursive query
can contain (no GROUP BY, for example). The idea is
slippery, but not quite as messy as it looks.

CREATE TABLE T (
Pid INT,
yr INT,
primary key (Pid,yr)
)
go

INSERT T (Pid,yr) VALUES(1,1)
INSERT T (Pid,yr) VALUES(1,4)
INSERT T (Pid,yr) VALUES(1,3)
INSERT T (Pid,yr) VALUES(1,5)
INSERT T (Pid,yr) VALUES(1,6)
INSERT T (Pid,yr) VALUES(1,9)
INSERT T (Pid,yr) VALUES(1,10)
INSERT T (Pid,yr) VALUES(2,29)
INSERT T (Pid,yr) VALUES(2,30)
INSERT T (Pid,yr) VALUES(2,31)
INSERT T (Pid,yr) VALUES(2,9)
INSERT T (Pid,yr) VALUES(2,130)
INSERT T (Pid,yr) VALUES(2,131)
INSERT T (Pid,yr) VALUES(2,132)
go

with Mins(iter,Pid,lastwrite,lastfound,rowYr,yrs) as (
select
0,
Pid,
min(yr),
min(yr),
min(yr),
cast(min(yr) as varchar(max))
from T
group by Pid
union all
select
Mins.iter+1,
Mins.Pid,
case when min(T.yr) over (partition by Mins.Pid) = Mins.lastfound + 1
--and Mins.rightest < Mins.upto
then Mins.lastwrite else min(T.yr) over (partition by Mins.Pid) end,
min(T.yr) over (partition by Mins.Pid),
T.yr,
Mins.yrs
+ case when min(T.yr) over (partition by Mins.Pid) Mins.lastfound + 1
then case when Mins.lastfound Mins.lastwrite
then rtrim(Mins.lastfound) else '' end
+ ',' + rtrim(min(T.yr) over (partition by Mins.Pid))
else case when Mins.lastfound = Mins.lastwrite
then '-' else '' end
end
from Mins join T
on Mins.Pid = T.Pid
and Mins.lastfound < T.yr
and Mins.rowYr = Mins.lastfound
), AllSteps(Pid,yrs,lastwrite,lastfound,rk) as (
select distinct Pid, yrs,lastwrite,lastfound,
rank() over (partition by Pid order by iter desc)
from Mins
)
select
Pid,lastwrite,
yrs + case when lastwrite < lastfound then rtrim(lastfound) else ','+rtrim(lastfound) end
from AllSteps
where rk = 1

go

-- Steve Kass
-- Drew University
-- http://www.stevekass.com
-- 95508D54-0B01-431B-8B58-880146787216|||Correction: The final SELECT should be

select
Pid,lastwrite,
yrs + case when lastwrite < lastfound then rtrim(lastfound) else '' end
from AllSteps
where rk = 1

The version I posted lists the last year twice, if it is not
part of a preceding range of years.

SK

Steve Kass wrote:

Quote:

Originally Posted by

Erland Sommarskog wrote:
>

Quote:

Originally Posted by

>
>
I could suggest a query which in SQL 2005 at least give you a comma-
separated list of the years. Collapsing adjacent years into ranges


appears

Quote:

Originally Posted by

to make things a lot more complicated.


>
Here is a recursive solution that will do the job when
MAXRECURSION is no greater than the number of separate
years for one individual player. Some of the complication
is to get around limitations in what a recursive query
can contain (no GROUP BY, for example). The idea is
slippery, but not quite as messy as it looks.
>


<snip>

Quote:

Originally Posted by

select
Pid,lastwrite,
yrs + case when lastwrite < lastfound then rtrim(lastfound) else
','+rtrim(lastfound) end
from AllSteps
where rk = 1
>
go
>
-- Steve Kass
-- Drew University
-- http://www.stevekass.com
-- 95508D54-0B01-431B-8B58-880146787216
>
>

|||Here is a guess at what you should have used for DDL if you had fgiven
us specs.

CREATE TABLE PlayerHistory
(player_id INTEGER NOT NULL
REFERENCES Pleyers(player_id)
team_name CHAR(15) NOT NULL
REFERENCES Teams(team_name),
start_year INTEGER NOT NULL
CHECK(start_year BETWEEN 1950 AND 9999),
end_year INTEGER
CHECK(start_year BETWEEN 1950 AND 9999),
CHECK(start_year <= end_year),
PRIMARY KEY ((player_id , team_name ,start_year)
);

A null end_year means the player is still with that team. You use a
VIEW with WHERE end_year IS NULL to get the current situation; you do
not put it in a separate table. What you seem to have is a table in
which an attribute (temproal duration) is split over several rows.

See how simple basic RDBMS design can save you from complex kludges?
Here is a guess at what you should have used for DDL if you had fgiven
us specs.

CREATE TABLE PlayerHistory
(player_id INTEGER NOT NULL
REFERENCES Pleyers(player_id)
team_name CHAR(15) NOT NULL
REFERENCES Teams(team_name),
start_year INTEGER NOT NULL
CHECK(start_year BETWEEN 1950 AND 9999),
end_year INTEGER
CHECK(start_year BETWEEN 1950 AND 9999),
CHECK(start_year <= end_year),
PRIMARY KEY ((player_id , team_name ,start_year)
);

A null end_year means the player is still with that team. You use a
VIEW with WHERE end_year IS NULL to get the current situation; you do
not put it in a separate table. What you seem to have is a table in
which an attribute (temproal duration) is split over several rows.

See how simple basic RDBMS design can save you from complex kludges?

Wednesday, March 21, 2012

Group Wise Page Numbers

Hi,
Iam printing a report having grouping, a group will spread over many pages and I want No. of pages for that group and also page number. for ex.

A report has 50 pages,

group 1 of 20 pages
group 2 of 10 pages
group 3 of 20 pages

I want No. of Pages 20 and current page as 1 of 20, 2 of 20. and for the second group again No. of Pages 10 and current page as 1 of 10, 2 of 10 and so on.

How do I do this.? can anyone help me on this.

thanks for ur suggestions in advance.Hi,

put Special Field "Page N of M"

now, Open Section Expert and navigate on first group level. there is one event "Reset Page Number After". Write below code on that

eg.
Previous({S_EVT_ACT.OWNER_LOGIN}) <> GroupName ({S_EVT_ACT.OWNER_LOGIN})

Using this code u get group wise Page N of M value.

-Yags|||Thanks ! it worked really.
I have one more question, which book is good for developing reports under vb 6.0 using crystal reports. suggest me one.

thanks again.|||Hi,

I have not prefered any book for Crystal Reports b'caz there is no book which
suitable for real crystal report development.

Sorry and most welcome for any issue regarding crystal reports

-Yags

Friday, March 9, 2012

Group by statement problem

I am using the T-SQL code below to pull patient information. The code returns 86 rows, however, there are only 9 distinct account numbers. Why is the group by statement not grouping these together to only display the 9 distinct accounts and associated data?

select
srm.episodes.episode_type as Visit_Type,
srm.episodes.account_number as Account_Number,
srm.episodes.medrec_no as MRN,
dbo.PtMstr.PatientFullName,
left(srm.episodes.admission_date,11) as Admit_Date,
left(srm.episodes.episode_date,11) as Disch_Date,
dbo.PtMstr.Cases as Cases,
dbo.PtMstr.TotCharges,
srm.cdmab_base_info.abst_cmp_status as Abtract_Comp_Status,
srm.cdmab_base_info.adm_dx_adt as Admitting_Dx
,srm.event_types.event_type_code
from srm.cdmab_base_info inner join
srm.episodes on srm.episodes.episode_key = srm.cdmab_base_info.episode_key
inner join srm.event_history on srm.event_history.item_key = srm.episodes.episode_key
inner join srm.event_types on srm.event_types.event_type_key = srm.event_history.event_type_key
inner join dbo.PtMstr on dbo.PtMstr.AccountNumber = srm.episodes.account_number
where srm.cdmab_base_info.abst_cmp_status <> 'Y'
and srm.episodes.episode_date is not null
and srm.event_types.event_type_code <> 'ACOD'
AND srm.EPISODES.EPISODE_DATE Between @.StartDate and @.EndDate
AND srm.EPISODES.EPISODE_TYPE IN(@.VisitTypeCode)
Group By srm.episodes.account_number,
dbo.PtMstr.TotCharges,
srm.episodes.episode_type,
srm.episodes.medrec_no,
dbo.PtMstr.PatientFullName,
srm.episodes.admission_date,
srm.episodes.episode_date,
dbo.PtMstr.Cases,
srm.cdmab_base_info.abst_cmp_status,
srm.cdmab_base_info.adm_dx_adt,
srm.event_types.event_type_code

Use the following query..

select

srm.episodes.episode_type as Visit_Type,

srm.episodes.account_number as Account_Number,

srm.episodes.medrec_no as MRN,

dbo.PtMstr.PatientFullName,

left(srm.episodes.admission_date,11) as Admit_Date,

left(srm.episodes.episode_date,11) as Disch_Date,

dbo.PtMstr.Cases as Cases,

dbo.PtMstr.TotCharges,

srm.cdmab_base_info.abst_cmp_status as Abtract_Comp_Status,

srm.cdmab_base_info.adm_dx_adt as Admitting_Dx

,srm.event_types.event_type_code

from

srm.cdmab_base_info

inner join srm.episodes on srm.episodes.episode_key = srm.cdmab_base_info.episode_key

inner join srm.event_history on srm.event_history.item_key = srm.episodes.episode_key

inner join srm.event_types on srm.event_types.event_type_key = srm.event_history.event_type_key

inner join dbo.PtMstr on dbo.PtMstr.AccountNumber = srm.episodes.account_number

where

srm.cdmab_base_info.abst_cmp_status <> 'Y'

and srm.episodes.episode_date is not null

and srm.event_types.event_type_code <> 'ACOD'

AND srm.EPISODES.EPISODE_DATE Between @.StartDate and @.EndDate

AND srm.EPISODES.EPISODE_TYPE IN(@.VisitTypeCode)

Group By

srm.episodes.account_number,

dbo.PtMstr.TotCharges,

srm.episodes.episode_type,

srm.episodes.medrec_no,

dbo.PtMstr.PatientFullName,

left(srm.episodes.admission_date,11) as Admit_Date,

left(srm.episodes.episode_date,11) as Disch_Date,

dbo.PtMstr.Cases,

srm.cdmab_base_info.abst_cmp_status,

srm.cdmab_base_info.adm_dx_adt,

srm.event_types.event_type_code

|||

I had to remove the AS portion of the group by clause to get the code to work , however, it still returns 86 rows versus the expected 9 distinct rows.

|||

How you know there is only 9 distinct record. You only the get the number of rows as per the following query..& i didn't understand your requirement on your query(there is no group by funcations used).

select Distinct

srm.episodes.episode_type as Visit_Type,

srm.episodes.account_number as Account_Number,

srm.episodes.medrec_no as MRN,

dbo.PtMstr.PatientFullName,

left(srm.episodes.admission_date,11) as Admit_Date,

left(srm.episodes.episode_date,11) as Disch_Date,

dbo.PtMstr.Cases as Cases,

dbo.PtMstr.TotCharges,

srm.cdmab_base_info.abst_cmp_status as Abtract_Comp_Status,

srm.cdmab_base_info.adm_dx_adt as Admitting_Dx

,srm.event_types.event_type_code

from

srm.cdmab_base_info

inner join srm.episodes on srm.episodes.episode_key = srm.cdmab_base_info.episode_key

inner join srm.event_history on srm.event_history.item_key = srm.episodes.episode_key

inner join srm.event_types on srm.event_types.event_type_key = srm.event_history.event_type_key

inner join dbo.PtMstr on dbo.PtMstr.AccountNumber = srm.episodes.account_number

where

srm.cdmab_base_info.abst_cmp_status <> 'Y'

and srm.episodes.episode_date is not null

and srm.event_types.event_type_code <> 'ACOD'

AND srm.EPISODES.EPISODE_DATE Between @.StartDate and @.EndDate

AND srm.EPISODES.EPISODE_TYPE IN(@.VisitTypeCode)

|||

I appreciate you help. I ordered the data by account number and saw there were 9 distinct account numbers. I also noticed the srm.event_types.event_type_code field should not have been in this query; once I removed it, the code returned the expected 9 rows of data using either of the examples you provided. Thanks again for your assistance.

|||

You are grouping several additional columns after the account number.

If you just want the nine accounts listed, you'll need to just group on that column.

Then you can apply aggregates to get sums, etc. of the other data you desire.

Wednesday, March 7, 2012

group by function not returning expected

Hi,
I am having trouble get the numbers that I need. I have a table that records
positions and the action that happened at that positon and the operator that
caused the action. I need to total the amounts per Operator per Action Code.
I tried to use GROUP BY but it only gave me one operator for each LotID. Thi
s
was the statement I used:
SELECT DISTINCT LotID, UserName, SUM(EncoderpositionDetectionEnd1) AS [End
1], ActionCode
FROM dbo.OperatorData
GROUP BY UserName, ActionCode, LotID
ORDER BY LotID
The following is an example of the data that is stored in the table.
LotID Operator Position Action Code
826O3 Priscilla 923797449 11
826O3 Priscilla 926950347 10
826O3 Priscilla 923797449 11
826O3 Priscilla 926950347 10
A1073 Susan 2946519574 11
826O3 Priscilla 960248867 11
82603 Gloria 885226642 10
82603 Gloria 893352901 11
82603 Angela 924485652 11
82603 Gloria 896646927 10
826O3 Priscilla 960248867 11
A1073 Susan 2946519574 11
82603 Angela 927628980 10
82603 Gloria 885226642 10
82603 Gloria 893352901 11
82603 Gloria 896646927 10
A1073 Carolyn 2915880805 10
82603 Angela 924485652 11Can you clarify this? The columns in your data do not match the columns in
your query. Also, do you need to sum (add stuff up) our count the rows? Also
,
you say you need the amounts per operator per action code but your group by
includes lot id.
"A.B." wrote:

> Hi,
> I am having trouble get the numbers that I need. I have a table that recor
ds
> positions and the action that happened at that positon and the operator th
at
> caused the action. I need to total the amounts per Operator per Action Cod
e.
> I tried to use GROUP BY but it only gave me one operator for each LotID. T
his
> was the statement I used:
> SELECT DISTINCT LotID, UserName, SUM(EncoderpositionDetectionEnd1) AS [End
> 1], ActionCode
> FROM dbo.OperatorData
> GROUP BY UserName, ActionCode, LotID
> ORDER BY LotID
> The following is an example of the data that is stored in the table.
> LotID Operator Position Action Co
de
> 826O3 Priscilla 923797449 11
> 826O3 Priscilla 926950347 10
> 826O3 Priscilla 923797449 11
> 826O3 Priscilla 926950347 10
> A1073 Susan 2946519574 11
> 826O3 Priscilla 960248867 11
> 82603 Gloria 885226642 10
> 82603 Gloria 893352901 11
> 82603 Angela 924485652 11
> 82603 Gloria 896646927 10
> 826O3 Priscilla 960248867 11
> A1073 Susan 2946519574 11
> 82603 Angela 927628980 10
> 82603 Gloria 885226642 10
> 82603 Gloria 893352901 11
> 82603 Gloria 896646927 10
> A1073 Carolyn 2915880805 10
> 82603 Angela 924485652 11
>|||SELECT DISTINCT LotID, UserName 'Operator',
SUM(EncoderpositionDetectionEnd1) AS [End
The LotID in order to connect the results to another query I have that gives
me the Lots that were run last w. Also I need the Sum of the rows.
"Kathi Kellenberger" wrote:
> Can you clarify this? The columns in your data do not match the columns in
> your query. Also, do you need to sum (add stuff up) our count the rows? Al
so,
> you say you need the amounts per operator per action code but your group b
y
> includes lot id.
>
>
> "A.B." wrote:
>|||With your query, you should get a row for every possible combination of
lotID, operator and action code. I'm not sure if that's what you are after.
"A.B." wrote:
> SELECT DISTINCT LotID, UserName 'Operator',
> SUM(EncoderpositionDetectionEnd1) AS [End
> The LotID in order to connect the results to another query I have that giv
es
> me the Lots that were run last w. Also I need the Sum of the rows.
> "Kathi Kellenberger" wrote:
>|||Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it. And your narrative is useless.|||That is what i want but this is an example of the results that I am getting:
62324 Pamela 9969832955 10
62324 Pamela 19966076115 11
62332 Susan 9641299760 11
62332 Teresa 9633011910 11
62334 Carolyn 9978382505 10
62334 Carolyn 19983575455 11
62334 Melissa 9719717360 10
I am only getting a one result for certain lots and several for others.
"Kathi Kellenberger" wrote:
> With your query, you should get a row for every possible combination of
> lotID, operator and action code. I'm not sure if that's what you are afte
r.
>
>
> "A.B." wrote:
>|||A.B.,
Kathy says you'll get one row for each combination of lotID, operator,
and action code,
and you say "That is what i want". This is exactly what you are
getting. The combinations
in your results are
(62324, Pamela, 10)
(62324, Pamela, 11)
(62332, Susan, 11)
(62332, Teresa, 11)
(62334, Carolyn, 10)
(62334, Carolyn, 11)
(62334, Melissa, 10)
You have more than one name and/or action code for some lotID values,
so you will get more than one row for those values. For example, for lotID
62334, you have information for Melissa with action code 10, and you have
information for Carolyn with action codes both 10 and 11. If you want only
one row for this lotID, do you want it to say Melissa or Carolyn, and do you
want the action code to be 10 or 11? You need to be more specific about
what your result is supposed to be.
Steve Kass
Drew University
A.B. wrote:
>That is what i want but this is an example of the results that I am getting
:
> 62324 Pamela 9969832955 10
> 62324 Pamela 19966076115 11
> 62332 Susan 9641299760 11
> 62332 Teresa 9633011910 11
> 62334 Carolyn 9978382505 10
> 62334 Carolyn 19983575455 11
> 62334 Melissa 9719717360 10
>I am only getting a one result for certain lots and several for others.
>"Kathi Kellenberger" wrote:
>
>|||No, because I am only getting the operator Pamela for Lot 62324 when actuall
y
there is four or five operators.
"Steve Kass" wrote:

> A.B.,
> Kathy says you'll get one row for each combination of lotID, operator,
> and action code,
> and you say "That is what i want". This is exactly what you are
> getting. The combinations
> in your results are
> (62324, Pamela, 10)
> (62324, Pamela, 11)
> (62332, Susan, 11)
> (62332, Teresa, 11)
> (62334, Carolyn, 10)
> (62334, Carolyn, 11)
> (62334, Melissa, 10)
> You have more than one name and/or action code for some lotID values,
> so you will get more than one row for those values. For example, for lotI
D
> 62334, you have information for Melissa with action code 10, and you have
> information for Carolyn with action codes both 10 and 11. If you want onl
y
> one row for this lotID, do you want it to say Melissa or Carolyn, and do y
ou
> want the action code to be 10 or 11? You need to be more specific about
> what your result is supposed to be.
> Steve Kass
> Drew University
>
> A.B. wrote:
>
>|||Ah. When you said "only one" for some and "several" for others, I
thought the problem was the "several", not the "one". ;)
My guess is that you are not showing us the entire query, since if there
is a row with LotID 62324 and operator <> 'Pamela' in dbo.OperatorData,
the result of
SELECT DISTINCT
LotID,
UserName 'Operator',
SUM(EncoderpositionDetectionEnd1) AS [End 1],
ActionCode
FROM dbo.OperatorData
GROUP BY UserName, ActionCode, LotID
ORDER BY LotID
will definitely include a row showing 62324 with another operator.
Perhaps you
are noting the omission only after this query is used in a larger one, maybe
with an inner join that should be a left join - I can't be sure.
If you are certain that this is your query and that results are missing,
please show us both the results of this query and the result of
SELECT TOP 10
LotID,
UserName, 'Operator',
EncoderpositionDetectionEnd1,
ActionCode
FROM dbo.OperatorData
WHERE LotID = '62324'
AND UserName <> 'Pamela'
-- optionally add ORDER BY something...
SK
A.B. wrote:
>No, because I am only getting the operator Pamela for Lot 62324 when actual
ly
>there is four or five operators.
>"Steve Kass" wrote:
>
>|||I had a date in the where clause to make my results alot smaller and by
taking the date out of the where clause it allowed me to see all of the
operators. I am not sure why this happened but it is working now. Thanks for
your help man.
"Steve Kass" wrote:

> Ah. When you said "only one" for some and "several" for others, I
> thought the problem was the "several", not the "one". ;)
> My guess is that you are not showing us the entire query, since if there
> is a row with LotID 62324 and operator <> 'Pamela' in dbo.OperatorData,
> the result of
> SELECT DISTINCT
> LotID,
> UserName 'Operator',
> SUM(EncoderpositionDetectionEnd1) AS [End 1],
> ActionCode
> FROM dbo.OperatorData
> GROUP BY UserName, ActionCode, LotID
> ORDER BY LotID
> will definitely include a row showing 62324 with another operator.
> Perhaps you
> are noting the omission only after this query is used in a larger one, may
be
> with an inner join that should be a left join - I can't be sure.
> If you are certain that this is your query and that results are missing,
> please show us both the results of this query and the result of
> SELECT TOP 10
> LotID,
> UserName, 'Operator',
> EncoderpositionDetectionEnd1,
> ActionCode
> FROM dbo.OperatorData
> WHERE LotID = '62324'
> AND UserName <> 'Pamela'
> -- optionally add ORDER BY something...
> SK
> A.B. wrote:
>
>