SQL Query Help
From: CJM (cjmwork_at_yahoo.co.uk)
Date: 06/10/04
- Next message: ARTMIC: "SQL Query Help"
- Previous message: Bob Barrows [MVP]: "Re: How to read an SQL Server into a ASP page and then change, add, delete and write it back to SQL Server"
- Next in thread: James Travis: "RE: SQL Query Help"
- Reply: James Travis: "RE: SQL Query Help"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: ARTMIC: "SQL Query Help"
- Previous message: Bob Barrows [MVP]: "Re: How to read an SQL Server into a ASP page and then change, add, delete and write it back to SQL Server"
- Next in thread: James Travis: "RE: SQL Query Help"
- Reply: James Travis: "RE: SQL Query Help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|