473,396 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't sort duplicates SQL Server 2000

28
Hey Everyone -

What would be the best way to sort data that has common fields? Here is my example:


Feature Date Order Number
===========================================
FLCHS 20070814 073576
STRCH 20070814 073576
AA10 20070814 073576

What I need is just one of the Items under feature based on a Hierarchy of the features. Its from the same order and I have to figure out how to build my query to say " IF features share the same Order Number, THEN check IF AA10 and FLCHS THEN Return only the STRCH. This customer is only getting STRCH and when I do a COUNT on this Order Number it returns "3" Items instead of just "1" which it should be just one and not 3. I need Logic to filter out the FLCHS and AA10. Any Ideas?

Thanks
Aug 21 '07 #1
11 1777
azimmer
200 Expert 100+
Hey Everyone -

What would be the best way to sort data that has common fields? Here is my example:


Feature Date Order Number
===========================================
FLCHS 20070814 073576
STRCH 20070814 073576
AA10 20070814 073576

What I need is just one of the Items under feature based on a Hierarchy of the features. Its from the same order and I have to figure out how to build my query to say " IF features share the same Order Number, THEN check IF AA10 and FLCHS THEN Return only the STRCH. This customer is only getting STRCH and when I do a COUNT on this Order Number it returns "3" Items instead of just "1" which it should be just one and not 3. I need Logic to filter out the FLCHS and AA10. Any Ideas?

Thanks
Will something like this do the job?
Expand|Select|Wrap|Line Numbers
  1. select a.[order number], a.[Date], a.[Feature]
  2. from T1 a, t1 b, t1 c
  3. where a.[order number]=b.[order number] and a.[order number]=c.[order number]
  4. and b.[Feature]='AA10' and c.[Feature]='FLCHS' and a.[Feature]='STRCH'
  5.  
Aug 21 '07 #2
dhutton
28
Will something like this do the job?
Expand|Select|Wrap|Line Numbers
  1. select a.[order number], a.[Date], a.[Feature]
  2. from T1 a, t1 b, t1 c
  3. where a.[order number]=b.[order number] and a.[order number]=c.[order number]
  4. and b.[Feature]='AA10' and c.[Feature]='FLCHS' and a.[Feature]='STRCH'
  5.  

Thanks for responding - Not sure about the FROM part. What does the T1a, t1 b, and t1 c represent? Anyway you could kind of break it down it simple terms for me?
I ge the "WHERE" logic - (sort of) I would like to say IF b.[Feature] = 'AA10' and c.[Feature] = 'FLCHS' and a.[Feature] = 'STRCH' THEN return ONLY 'STRCH'

Thanks
Aug 21 '07 #3
azimmer
200 Expert 100+
Thanks for responding - Not sure about the FROM part. What does the T1a, t1 b, and t1 c represent? Anyway you could kind of break it down it simple terms for me?
I ge the "WHERE" logic - (sort of) I would like to say IF b.[Feature] = 'AA10' and c.[Feature] = 'FLCHS' and a.[Feature] = 'STRCH' THEN return ONLY 'STRCH'

Thanks
What I did was to join the same table (T1 in my example as you did not provide the name of your table) three times. One does this in SQL by assigning different aliases to the table (a,b, and c in my example).
The first part of the WHERE clause (first two terms) are the join ones, they make sure each row in the join table belong to the same order number. But if you go this far only all possible combinations of features will show up. (Do try it: SELECT * FROM T1 a, t1 b, t1 c
WHERE a.[order number]=b.[order number] and a.[order number]=c.[order number])
The next part of the WHERE clause makes sure only the relevant one line is selected (if there's any): if it has an AA10 feature (say in alias 'b' but it doesn't really matter), it has an FLCHS feature (in alias 'c' in my case), and also has a STRCH feature, return the row. If any of those do not show up (i.e. at least one is missing) there will be no matching combo and thus the row will not show up. Obviously if the combo does exist it shows up only once (in the join table all possible permutations (related to the same order number) show up once and only once).
Hope it makes sense.
Aug 21 '07 #4
dhutton
28
Yeah - that makes sense but.....

What if I'm using JOINS already - here are my actual tables:


=================================================

SELECT so.Order#, sv7.Item, so.soCreated,

FROM ctcmaster.dbo.ServiceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#
==================================================
The SV02 table doesnt matter in this case but how would I apply your example with my JOINED tables? (If you help me fix this I will pay you - I swear)
Aug 22 '07 #5
azimmer
200 Expert 100+
Yeah - that makes sense but.....

What if I'm using JOINS already - here are my actual tables:


=================================================

SELECT so.Order#, sv7.Item, so.soCreated,

FROM ctcmaster.dbo.ServiceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#
==================================================
The SV02 table doesnt matter in this case but how would I apply your example with my JOINED tables? (If you help me fix this I will pay you - I swear)
OK, a bit of explanation before we get to the answer. It may not be technically 100% but hopefully understandable.

You can assign a (table) alias to anything you can SELECT from, that is whatever appears in the FROM clause: these are usually tables and/or views but can be sub-selects or joined tables as well.

Let's say you have (without proper definitions):
table1: idcol and col1
table2: idcol and col2
table3: idcol and col3
table4: idcol and col4

You can "alias a join" like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT x.col1, x.col2
  2. FROM (table1 a inner join table2 b on a.idfield=b.idfield) as x
  3.  
NB: Although the example shows two different tables (table1, table2) SQL doesn't care about this: you can join a table to itself (it's called a self join).

A step further you can select from two joins, like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT x.col1, x.col2, y.col3
  2. FROM (table1 a inner join table2 b on a.idfield=b.idfield) as x inner join (table3 c inner join table4 d on c.idfield=d.idfield) as y on x.col1=y.col1
  3.  
Well, here we go, you only need to replace T1 with whatever generates your table, in your case:
T1 <= ctcmaster.dbo.ServiceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#

Though it's perfectly OK for SQL Server this way, I usually find - after a certain point - that readability reasons kind of force me to create view(s); especially that you need the same select three times (typos often come in, etc). Then simply create T1 as a view and use the original select.

Hope it makes sense. If it gets much more complicated we are going to have a hard time fix it like this. It would also help to see how far you've got by yourself (so that I can assess what level of explanation makes sense to you).

PS: You can't pay me; I won't let you ;). Our clients pay my company and that's OK - it's a different ballgame. Swear to help somebody else in need.
Aug 22 '07 #6
dhutton
28
Wow - great stuff, Thanks!

I actually ran your example and it works - but I cant seem to get it to work with my FROM statement below - I'm not sure how to plug in the t1 b and t1 c

So make T1 = FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order# INNER JOIN
ctcsec.dbo.BLSEIT AS bl
ON sv7.Item = bl.SEIITM

Then the other t1b and t1c wold go something like this

FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order# INNER JOIN
ctcsec.dbo.BLSEIT AS bl
ON sv7.Item = bl.SEIITM JOIN
t1 b, t1 c
Aug 22 '07 #7
azimmer
200 Expert 100+
Wow - great stuff, Thanks!

I actually ran your example and it works - but I cant seem to get it to work with my FROM statement below - I'm not sure how to plug in the t1 b and t1 c

So make T1 = FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order# INNER JOIN
ctcsec.dbo.BLSEIT AS bl
ON sv7.Item = bl.SEIITM

Then the other t1b and t1c wold go something like this

FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order# INNER JOIN
ctcsec.dbo.BLSEIT AS bl
ON sv7.Item = bl.SEIITM JOIN
t1 b, t1 c
OK, let's make it simpler and do it in two steps.

First step:
Expand|Select|Wrap|Line Numbers
  1. CREATE VIEW myJoinView
  2. AS
  3. SELECT *
  4. FROM ctcmaster.dbo.ServiceOrders AS so JOIN
  5. ctcsec.dbo.SV02 AS sv2 ON
  6. so.order# = sv2.SV2SO# JOIN
  7. ctcsec.dbo.SV07 AS sv7 ON
  8. so.order# = sv7.Order#
  9.  
  10. GO
  11.  
Second step:
Expand|Select|Wrap|Line Numbers
  1. select a.[order number], a.[Date], a.[Feature]
  2. from myJoinView a, myJoinView b, myJoinView c
  3. where a.[order number]=b.[order number] and a.[order number]=c.[order number]
  4. and b.[Feature]='AA10' and c.[Feature]='FLCHS' and a.[Feature]='STRCH'
  5.  
Let's see if it works out for you.
Aug 22 '07 #8
dhutton
28
Ok - This is what I have so far:

======================

SELECT COUNT(a.Order#) AS Total, a.Item

FROM dh_JoinView a, dh_JoinView b, dh_JoinView c, dh_JoinView d

WHERE a.Order# = b.Order# AND a.Order# = c.Order# AND d.Item
LIKE 'AA%' AND c.Item LIKE 'AB%' AND b.Item = 'FLCHS' AND a.Item = 'HBOCH'

GROUP BY a.Item

======================

These are my actual field names I'm using:

so.Order# (so. is from my JOIN of ServiceOrders AS so) and sv.Item (sv7 from my JOIN of SV07 AS sv7

************** Problem is I'm getting the following error when I start my query:


Server: Msg 207, Level 16, State 3, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.

***********************************************

So I suspect the way I have my view defined my be the problem - here is my view:

CREATE VIEW dh_JoinView
AS
SELECT COUNT(DISTINCT so.Order#) AS Total, sv7.Item AS Item, so.soCreated, so.Order# AS OrderNumber, so.OrderType AS OType, so.BillCycle
FROM ctcmaster.dbo.ServiceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#

GROUP BY sv7.Item, so.soCreated, so.Order#, so.Ordertype, so.BillCycle

================================================== =====

I followed your instructions on the create view - but when I ran it, an error came up complaining about what I have in my SELECT wasn't defined by a GROUP BY - so I added a GROUP BY statement as you see above.

Thanks for your help - U da Man!
Aug 23 '07 #9
azimmer
200 Expert 100+
Ok - This is what I have so far:

======================

SELECT COUNT(a.Order#) AS Total, a.Item

FROM dh_JoinView a, dh_JoinView b, dh_JoinView c, dh_JoinView d

WHERE a.Order# = b.Order# AND a.Order# = c.Order# AND d.Item
LIKE 'AA%' AND c.Item LIKE 'AB%' AND b.Item = 'FLCHS' AND a.Item = 'HBOCH'

GROUP BY a.Item

======================

These are my actual field names I'm using:

so.Order# (so. is from my JOIN of ServiceOrders AS so) and sv.Item (sv7 from my JOIN of SV07 AS sv7

************** Problem is I'm getting the following error when I start my query:


Server: Msg 207, Level 16, State 3, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.
Server: Msg 207, Level 16, State 1, Line 2
Invalid column name 'Order#'.

***********************************************

So I suspect the way I have my view defined my be the problem - here is my view:

CREATE VIEW dh_JoinView
AS
SELECT COUNT(DISTINCT so.Order#) AS Total, sv7.Item AS Item, so.soCreated, so.Order# AS OrderNumber, so.OrderType AS OType, so.BillCycle
FROM ctcmaster.dbo.ServiceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#

GROUP BY sv7.Item, so.soCreated, so.Order#, so.Ordertype, so.BillCycle

================================================== =====

I followed your instructions on the create view - but when I ran it, an error came up complaining about what I have in my SELECT wasn't defined by a GROUP BY - so I added a GROUP BY statement as you see above.

Thanks for your help - U da Man!
Could you, please, post the table definitions with some sample data so that I can try?
Aug 24 '07 #10
dhutton
28
Could you, please, post the table definitions with some sample data so that I can try?
Ok- Here is 50 Lines of Data that the query can be used on.

These Item codes are cable TV packages and what I;m trying to do is get a count on New Installs and Disconnects for a daily, weekly, or monthly reports. I then post these on the SQL Reporting Services web via visual studio.NET - anyways...

In the data below there are some good examples of data I'm trying to parse and get a good count on. For example, if you take a look at OrderNumber 067950
you will see a total of 4 Item Codes AA001, AA01, AB00 and TLCHS.
This customer is getting a premium package called Total Package with the Item code of TLCHS. The Item codes list in a hierarchy kind of way.

================================================
Basic = (AA00, AA000, AA001, AA01, and AA10) any one of these Item codes = Basic

Prime = (AB00, AB01 and AB10) any one of these Item codes = Prime

Full = FLCHS

Total = TLCHS

=================================================


So this customer is getting TLCHS but has the AA's and AB's Item codes in there as well and I don't need to count those - I just need to count the TLCHS.

FULL
If the customer was getting the Full package the Item codes would list as AA(something) AB(something) and FLCHS (AA00, AB01 and FLCHS)

PRIME
If the customer was getting Prime the Item codes would be AA% (wild card for something) and AB% (AA10 and AB00)

BASIC
If the customer was getting just Basic service the Item code would be AA something. (AA10)

================================================== ==
***Note
By the way.... I could simply remove the Item field and get a good count for each OrderNumber listed - but would lose the benefits of displaying what Item was actually being installed, upgraded or disconnected.

================================================== ==
Other packages exist and once I get the logic figured out I can apply it towards them also, like the OrderNum 067916 below.


So my Tables I'm getting my data from are as follows:

Item comes from a table called SV07

soCreated from table ServiceOrders

OrderNumber is what I JOIN the tables with - its on both ServiceOrders and SV07. There are other citeria I need to make the OrderNumbers valid towards my total counts and below is the complete FROM statement I use:

FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order# INNER JOIN
ctcsec.dbo.BLSEIT AS bl
ON sv7.Item = bl.SEIITM

================================================== ==

WHERE Statement

Here is a sample of my WHERE statement I use:

WHERE so.soCreated BETWEEN '20070701' AND '20070731' AND so.PhoneNum BETWEEN '9990000000' AND '9990109999' AND so.OrderType IN ('NI', 'MI', 'BR', 'RE') AND so.Status <> 'D' AND sv7.Status <> 'D' AND bl.SEITRF = ' ' AND bl.SEISTP = ' ' AND sv7.ITEM IN ('BNDMX', 'BNDST', 'BNDSH', 'BNDHB', 'BNDSP', 'BNDSN','MAXCH', 'STRCH', 'SHOWT', 'HBOCH', 'SPCHS', 'SNCHS', 'AA00', 'AA000', 'AA001', 'AA01', 'AA10', 'PRIME', 'AB00', 'AB01', 'AB10', 'FULL', 'FLCHS', 'TOTAL', 'TLCHS', 'HDALL' ) AND sv7.InOut = 'I'

================================================== ==

So the bottom line of what I'm trying to achieve is basically per OrderNumber :

CHECK AA% AB% FLCHS and TLCHS

IF OK THEN Count Only TLCHS

IF NOT OK

THEN CHECK AA% AB% and FLCHS

IF OK THEN Count Only FLCHS

IF NOT OK

THEN CHECK AA% AB%

IF OK THEN Count Only AB%

IF NOT OK

THEN CHECK AA%

IF OK THEN Count only AA%

================================================== ====

I tried adding the data below in a comma delimited form but doesnt seem to work - wanted to give you something you could import into Exel or something.

Thanks!!


Total_____Item___soCreated__OrderNumber
=================================
1 PRIME 20070702 67886
1 BVP62 20070702 67916
1 BNDMX 20070702 67916
1 BNDST 20070702 67916
1 AA01 20070702 67966
1 BVP53 20070702 67966
1 AA01 20070702 67995
1 AA01 20070702 68020
1 AB10 20070702 68020
1 AA01 20070702 68029
1 AB01 20070702 68029
1 FULL 20070702 67918
1 PRIME 20070702 67938
1 AA00 20070702 67902
1 AA10 20070702 68000
1 AB10 20070702 68000
1 AA01 20070702 67977
1 AB10 20070702 67977
1 AA01 20070702 67979
1 PRIME 20070702 67981
1 AA01 20070702 67988
1 PRIME 20070702 67992
1 AA01 20070702 67993
1 BVP60 20070702 67993
1 AB00 20070702 67983
1 FLCHS 20070702 67989
1 AB00 20070702 68015
1 AA00 20070702 68015
1 AB00 20070702 67948
1 AA00 20070702 67948
1 AB00 20070702 67939
1 AA00 20070702 67939
1 TLCHS 20070702 67950
1 AB00 20070702 67950
1 AA01 20070702 67950
1 AA001 20070702 67950
1 FLCHS 20070702 67958
1 AB00 20070702 67996
1 AB10 20070703 68103
1 AA01 20070703 68103
1 AB01 20070703 68129
1 AA01 20070703 68129
1 AA01 20070703 68158
1 FULL 20070703 68187
1 PRIME 20070703 68188
1 FULL 20070703 68076
1 PRIME 20070703 68110
1 FULL 20070703 68153
1 FULL 20070703 68153
1 AA001 20070703 68074
Aug 24 '07 #11
azimmer
200 Expert 100+
Hi, I read your post and hopefully understand most of it. IMHO only a smaller portion is needed for the solution, I'll quote it as we walk through. The data was extremely helpful.

Instead of just giving you a SELECT I want you to understand how and why it works. (Don't worry, you'll have the SELECT by the end of the preach ;-)-)

Let's say that query that you used to generate the data in the post is Q1. For clarity first create a view as follows:
Expand|Select|Wrap|Line Numbers
  1. CREATE VIEW MyOrder
  2. AS
  3. < Q1 >
  4. GO
  5.  
(Simply copy-paste the query instead of "< Q1 >"). Check it by running SELECT * FROM MyOrder

(Note: My understanding is that your query ("real" Q1) is the one whose "FROM" you posted, thus eventually you'll need:
Expand|Select|Wrap|Line Numbers
  1. CREATE VIEW MyOrder
  2. AS
  3. SELECT so.order# as OrderNumber, Item, Total, soCreated
  4. FROM ctcmaster.dbo.ServiceOrders AS so INNER JOIN
  5. ctcsec.dbo.SV02 AS sv2 ON
  6. so.order# = sv2.SV2SO# INNER JOIN
  7. ctcsec.dbo.SV07 AS sv7 ON
  8. so.order# = sv7.Order# INNER JOIN
  9. ctcsec.dbo.BLSEIT AS bl
  10. ON sv7.Item = bl.SEIITM
  11.  
but I'm not 100% sure.)

Now, to the point:
...
So the bottom line of what I'm trying to achieve is basically per OrderNumber :

CHECK AA% AB% FLCHS and TLCHS

IF OK THEN Count Only TLCHS

IF NOT OK

THEN CHECK AA% AB% and FLCHS

IF OK THEN Count Only FLCHS

IF NOT OK

THEN CHECK AA% AB%

IF OK THEN Count Only AB%

IF NOT OK

THEN CHECK AA%

IF OK THEN Count only AA%
...
First, we'll turn your table into crosstab format with only AA%, AB%, FLCHS and TLCHS columns (i.e. all other items are disregarded):
Expand|Select|Wrap|Line Numbers
  1.     select OrderNumber,
  2.         sum(case left(Item,2) when 'AA' then 1 else 0 end) as AA,
  3.         sum(case left(Item,2) when 'AB' then 1 else 0 end) as AB,
  4.         sum(case Item when 'FLCHS' then 1 else 0 end) as FLCHS,
  5.         sum(case Item when 'TLCHS' then 1 else 0 end) as TLCHS
  6.     from MyOrders
  7.     group by OrderNumber
  8.  
Do run it against the data you sent me. This is what I got:
Expand|Select|Wrap|Line Numbers
  1. OrderNumber AA          AB          FLCHS       TLCHS       
  2. ----------- ----------- ----------- ----------- ----------- 
  3. 67886       0           0           0           0
  4. 67902       1           0           0           0
  5. 67916       0           0           0           0
  6. 67918       0           0           0           0
  7. 67938       0           0           0           0
  8. 67939       1           1           0           0
  9. 67948       1           1           0           0
  10. 67950       2           1           0           1
  11. ...
  12. 68158       1           0           0           0
  13. 68187       0           0           0           0
  14. 68188       0           0           0           0
  15.  
  16. (33 row(s) affected)
  17.  
It's quite simple: the case statements generate 1 or 0 in each column depending on whether the row meets the condition (obviously there will be no more than one '1' colmn in each line). The SUMs make sure that all of these rows are summarized to each order number. (You can try to remove the "sum"s and replace "group by" with "order by" to see the individual rows -- and hopefully see what I was trying to explain.)

Now comes the final SELECT that pulls data from this crosstab:
Expand|Select|Wrap|Line Numbers
  1. select OrderNumber,
  2.     (case    when (AA>0 and AB>0 and FLCHS>0 and TLCHS>0) then TLCHS
  3.         when (AA>0 and AB>0 and FLCHS>0) then FLCHS
  4.         when (AA>0 and AB>0) then AB
  5.         when (AA>0) then AA
  6.         else 0
  7.      end) as FinalCount
  8. from (
  9.     select OrderNumber,
  10.         sum(case left(Item,2) when 'AA' then 1 else 0 end) as AA,
  11.         sum(case left(Item,2) when 'AB' then 1 else 0 end) as AB,
  12.         sum(case Item when 'FLCHS' then 1 else 0 end) as FLCHS,
  13.         sum(case Item when 'TLCHS' then 1 else 0 end) as TLCHS
  14.     from MyOrders
  15.     group by OrderNumber
  16. ) as OrdersCrossTab
  17.  
It checks your conditions (one after the other) and makes sure that the proper columns of the crosstab is counted. (NB: we make use of the precedence property of the case statement: it returns when first finds a matching condition; i.e.: all lines that match condition #2 also match condition #3 but it doesn't matter because 'case' returns when found match at condition #2.)

For me, it returns:
Expand|Select|Wrap|Line Numbers
  1. OrderNumber FinalCount  
  2. ----------- ----------- 
  3. 67886       0
  4. 67902       1
  5. 67916       0
  6. ...
  7. 68129       1
  8. 68153       0
  9. 68158       1
  10. 68187       0
  11. 68188       0
  12.  
  13. (33 row(s) affected)
  14.  
Hope it's clear and helps.
Aug 25 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: kj | last post by:
When I run the attached query, I get duplicates when there is one to many relationship between tableA and tableB. The query, tested schema and the result is attached. Sorry for the long post. ...
3
by: Shawn | last post by:
Hi guys, I'm trying to compose a query that will select all columns from a table, but without any duplicates. E.g. table name is 'tblShipment' columns are: fldUnique(pk) | fldShipNo |...
5
by: wackyphill | last post by:
I have a table I insert a record into to give access to a user. It uses primary keys so duplicates are not allowed, so trying to add a record for a user more than once is not allowed. In my .NET...
9
by: paul | last post by:
Hiya everyone, I have two tables in SQL 2000. I would like to append the contents of TableA to TableB. Table A has around 1.1 Million Records. Table B has around 1 Million Reocords. ...
1
by: GGerard | last post by:
Hello I am working with Access 2000 I have two tables joined on a one to many relationship between two fields: Table1:FieldID (one) is joined to Table2:FieldMyID (many) Field Properties...
19
by: davegb | last post by:
Have been trying, in my spare time, to create an Access db for the employees in my group for over a month. It surprised me when I read in the Access Bible that a relationship between the Primary...
5
by: ken | last post by:
Hi, Lets say you have a report with 10 rows. The first 4 of them have duplicate values in a given field. So you set the Hide Duplicates property to Yes and when you preview the report it shows you...
1
by: akg250978 | last post by:
ok here is my problem i created the JS to insert rows in an html doc, this works perfectly but if i was to refresh the page or leave it and return to it L8 the rows have diappeared here is the...
4
by: apatel85 | last post by:
Hey Guys, Total Number of Records (Based on 5 fields): 1000 Total Unique Records (Based on 5 Fields): 990 Total number of fields: 5 I have question regarding extracting duplicates from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.