Click here to Skip to main content
16,015,518 members
Home / Discussions / Database
   

Database

 
GeneralRe: Nsted SELECT statements Pin
munawarhussain11-Nov-04 9:03
munawarhussain11-Nov-04 9:03 
GeneralRe: Nsted SELECT statements Pin
Christian Graus11-Nov-04 9:05
protectorChristian Graus11-Nov-04 9:05 
GeneralRe: Nsted SELECT statements Pin
Colin Angus Mackay4-Nov-04 20:29
Colin Angus Mackay4-Nov-04 20:29 
GeneralRe: Nsted SELECT statements Pin
Den2Fly4-Nov-04 21:25
Den2Fly4-Nov-04 21:25 
GeneralRe: Nsted SELECT statements Pin
Christian Graus4-Nov-04 22:19
protectorChristian Graus4-Nov-04 22:19 
GeneralCall multiple stored procs in the same query Pin
Luis Alonso Ramos4-Nov-04 7:12
Luis Alonso Ramos4-Nov-04 7:12 
GeneralRe: Call multiple stored procs in the same query Pin
Christian Graus4-Nov-04 12:30
protectorChristian Graus4-Nov-04 12:30 
GeneralJOIN with optional field Pin
Luis Alonso Ramos4-Nov-04 6:33
Luis Alonso Ramos4-Nov-04 6:33 
Hello,

I'm building a stored procedure (for MSDE) in the Access designer. I have a Sales table, and a Packages table (for a car wash). Each sale can have an exterior package and a interior package, each field containing the ID of the record in the Packages table.

I want my stored procedure to return the Name for both the interior and exterior packages. The problem is, if one of the fields has a 0 (no package sold, for example only exterior wash), my stored procedure returns an empty resultset.

I would like it to return that field empty (or NULL) and still return the full row (there's other info on the Sales table like Date and customer ID.)

In case it's important, this is my query (from Access SQL view):
ALTER PROCEDURE dbo.GetSaleInfo
(@ID_sale int)
AS SELECT     dbo.Sales.Date, dbo.Sales.Time, dbo.Vehicles.Make + ' ' + dbo.Vehicles.Model AS CarModel, dbo.Packages.Name AS ExteriorPackage, 
                      Packages_1.Name AS InteriorPackage, dbo.Promotions.Name AS Promotion
FROM         dbo.Sales INNER JOIN
                      dbo.Vehicles ON dbo.Sales.ID_vehicle = dbo.Vehicles.ID_vehicle INNER JOIN
                      dbo.Packages ON dbo.Sales.ExteriorPackage = dbo.Packages.ID_package INNER JOIN
                      dbo.Promotions ON dbo.Sales.ID_promotion = dbo.Promotions.ID_promotion INNER JOIN
                      dbo.Packages Packages_1 ON dbo.Sales.InteriorPackage = Packages_1.ID_package
WHERE     (dbo.Sales.ID_sale = @ID_sale)
Any ideas?

-- LuisR



Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!

GeneralRe: JOIN with optional field Pin
Edbert P4-Nov-04 11:08
Edbert P4-Nov-04 11:08 
GeneralRe: JOIN with optional field Pin
Luis Alonso Ramos4-Nov-04 14:05
Luis Alonso Ramos4-Nov-04 14:05 
GeneralFind out if a table name already exists Pin
veronique4-Nov-04 5:32
veronique4-Nov-04 5:32 
GeneralRe: Find out if a table name already exists Pin
Colin Angus Mackay4-Nov-04 6:59
Colin Angus Mackay4-Nov-04 6:59 
GeneralRe: Find out if a table name already exists Pin
veronique4-Nov-04 22:38
veronique4-Nov-04 22:38 
Questionhow to obtain in a fecht a dir result? Pin
Anonymous3-Nov-04 23:56
Anonymous3-Nov-04 23:56 
GeneralStored Procedure Pin
Its due when3-Nov-04 17:52
Its due when3-Nov-04 17:52 
GeneralRe: Stored Procedure Pin
Colin Angus Mackay4-Nov-04 0:42
Colin Angus Mackay4-Nov-04 0:42 
GeneralRe: Stored Procedure Pin
Grimolfr5-Nov-04 9:43
Grimolfr5-Nov-04 9:43 
GeneralRe: Stored Procedure Pin
Colin Angus Mackay5-Nov-04 10:44
Colin Angus Mackay5-Nov-04 10:44 
GeneralRe: Stored Procedure Pin
Grimolfr5-Nov-04 15:17
Grimolfr5-Nov-04 15:17 
GeneralRe: Stored Procedure Pin
Colin Angus Mackay5-Nov-04 20:16
Colin Angus Mackay5-Nov-04 20:16 
GeneralRe: Stored Procedure Pin
Its due when7-Nov-04 17:22
Its due when7-Nov-04 17:22 
GeneralTo Get the Id from the database which are not deleted Pin
Irsh3-Nov-04 2:14
Irsh3-Nov-04 2:14 
GeneralAdding or Substracting time spans from a DateTime SQL value Pin
Den2Fly2-Nov-04 23:32
Den2Fly2-Nov-04 23:32 
GeneralRe: Adding or Substracting time spans from a DateTime SQL value Pin
Colin Angus Mackay3-Nov-04 0:09
Colin Angus Mackay3-Nov-04 0:09 
GeneralRe: Adding or Substracting time spans from a DateTime SQL value Pin
Den2Fly3-Nov-04 12:15
Den2Fly3-Nov-04 12:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.