SQL Query Help

From: CJM (cjmwork_at_yahoo.co.uk)
Date: 06/10/04


Date: Thu, 10 Jun 2004 13:17:14 +0100

I am try to build an SP that queries two table, Filters and Locations.

Each filter is in one location only. I want to list all the locations, and
for each location, list the PartNo and the number of filters in that
location, eg:

PartNo, Location1, Location2, Location3
-----------------------------------------------------
PartA, 10, 20, 30
PartB, 5, 5, 5
PartC, 0, 5, 10
etc

Filters:
CREATE TABLE [dbo].[Filters] (
 [SerialNo] [int] NOT NULL ,
 [PartNo] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
 [LocationID] [int] NOT NULL ,
 [CustomerID] [int] NOT NULL
) ON [PRIMARY]
GO

Locations (snipped):
CREATE TABLE [dbo].[Locations] (
 [LocationID] [int] IDENTITY (1, 1) NOT NULL ,
 [LocationName] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL ,
 [CustomerID] [int] NOT NULL ,
 [Town] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL ,
 [TelNo] [varchar] (15) COLLATE Latin1_General_CI_AS NULL ,
 [FaxNo] [varchar] (15) COLLATE Latin1_General_CI_AS NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

Can somebody give me a start on how to contruct this query?

Thanks

Chris



Relevant Pages

  • Manipulating audio data with filters
    ... I'm trying to capture .wav data and manipulate it using filters, ... private AudioInputStream audioInput; ... int numChannels,frameLengthInt; ... AudioFileFormat.Type targetFileType = ...
    (comp.lang.java.programmer)
  • Manipulating audio data with filters
    ... I'm trying to capture .wav data and manipulate it using filters, ... private AudioInputStream audioInput; ... int numChannels,frameLengthInt; ... AudioFileFormat.Type targetFileType = ...
    (comp.lang.java.help)
  • Re: SQL Query Help
    ... modify it for your needs ... create function dbo.fn_my (@id int) ... > I am try to build an SP that queries two table, Filters and Locations. ...
    (microsoft.public.sqlserver.programming)
  • SQL Query Help
    ... I am try to build an SP that queries two table, Filters and Locations. ... [CustomerID] ...
    (microsoft.public.sqlserver.programming)
  • Re: Multiple large queries vs. One big/several small queries
    ... Access back-end)? ... filters so that altogether they retrieve all the data (qryMB59 has all the ... I have a report that brings all these queries together in an ...
    (microsoft.public.access.queries)

Loading