Quantcast
Channel: Questions in topic: "database-objects"
Viewing all articles
Browse latest Browse all 22

How can I create a view with parameters?

$
0
0

I have a sales data view which returns the data from a transaction table as well as the items that are related to those transactions:

SELECT [items].[Type], [items].[Value], [items].[Name], [transactions].[Number]
  FROM [log].[transactions] INNER JOIN
       [log].[items] on [items].[transactionID] = [transactions].[ID]

However, the need has arisen for the view to return only specific types of items in specific circumstances. What I would like to be able to do is INNER JOIN to the view, but passing in a specific list of item types... Is there any way that I can achieve this functionality without creating a view for each of the item type combinations that are available?

(seeder)


Viewing all articles
Browse latest Browse all 22

Trending Articles