Re: Coding file into 4ths

From: Duane Hookom (duanehookom_at_NO_SPAMhotmail.com)
Date: 02/12/04


Date: Wed, 11 Feb 2004 20:12:46 -0600

Not sure about your table structure and values but if you want to group
Customers in the Northwind database based on their customer id:
SELECT ((SELECT Count(*) FROM Customers c
   WHERE c.CustomerID <Customers.CustomerID)*4) \
  (SELECT Count(*) FROM Customers) AS GroupNumber,
   Customers.CustomerID, Customers.CompanyName
FROM Customers;

1/4th of the customers will have GroupNumber = 0. 1/4th will be 1 etc.

-- 
Duane Hookom
MS Access MVP
"Hal Pratt" <pdihal@comcast.net> wrote in message
news:d8KdnQwI5qtAVbfdRVn-gg@comcast.com...
> What I'm looking to do is Nth code a list into fourths (i.e., record 1=A,
> rec 2=B, rec 3=C, rec 4=D, rec 5=A, rec 6=B and so on)
>
> "[MVP] S.Clark" <Steve.Clark_NOSPAM@FMSInc.com> wrote in message
> news:eTXno797DHA.1948@TK2MSFTNGP12.phx.gbl...
> > Define what you mean by "coded".
> >
> > Use 4 make table queries to write the data from the 1 table to each of
the
> 4
> > tables.
> >
> >
> > --
> > HTH,
> >
> > Steve Clark, Access MVP
> > FMS, Inc.
> > Professional Solutions Group
> > http://www.FMSInc.com
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > Is your Access database too slow?
> > Are you ready to upgrade to SQL Server?
> > Contact us for optimization and/or upsizing!
> > http://www.FMSInc.com/consulting
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >
> > "Hal Pratt" <pdihal@comcast.net> wrote in message
> > news:gICdnaB0FPlC2rXdRVn-ug@comcast.com...
> > > I have customer file with hundreds of unique autonumbers [ID] which
need
> > to
> > > be coded into 4 groups of equal size. Is there a way to do it in with
a
> > > single expression?
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: SQL 2005 - audit SELECT statements?
    ... name in the Northwind database. ... Start the trace, and create the following trigger using Query Analyzer: ... FROM Customers ...
    (microsoft.public.sqlserver.security)
  • Re: Why cant i find a row in a dataset?
    ... > Currently had a Dataset that has information from the Northwind database, ... > Customers table in it. ... why when I enter ALFKI in txtCustomerID.Text is it not ... > Paul Custance ...
    (microsoft.public.dotnet.framework)
  • Re: i would like to see who executed a select statement on a specific table
    ... name in the Northwind database. ... and create the following trigger using Query Analyzer: ... FROM Customers ... FROM Customers c INNER JOIN Orders o ...
    (microsoft.public.sqlserver.security)
  • Re: Linq Sum() Question
    ... I made a console application that makes use of Northwind database. ... Made a dbml file of the database whith the designer and now I want to ... see the total of all orders of the customers. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Subtotal
    ... >> Duane Hookom ... >> MS Access MVP ... >>> customers, and then a subtotal of the next 35 customers, and than a ... >>> subtotals. ...
    (microsoft.public.access.reports)