Reputation: 17
I have the entire table being pulled in but I want it set up so the only rows that are displayed are the ones with specific information in one column.
Here is my SELECT statement:
SELECT [Day], aoc, ryg, reasoning, notes FROM dbo.ryg_conditions ORDER BY aoc ASC,[Day] DESC
But I only want to display rows that have "Administration" in the aoc column and then sort those by the date.
I'm new to ASP and databases, please help?
Upvotes: 1
Views: 160
Reputation: 3353
You need to use a WHERE statement.
SELECT [Day], aoc, ryg, reasoning, notes
FROM dbo.ryg_conditions
WHERE aoc = 'Administration'
ORDER BY aoc ASC,[Day] DESC
Upvotes: 1
Reputation: 7797
You need to look into WHERE
In your case, you would add to your query:
SELECT [Day], aoc, ryg, reasoning, notes
FROM dbo.ryg_conditions
WHERE aoc = 'Administration'
ORDER BY aoc ASC,[Day] DESC
Upvotes: 1
Reputation: 16677
you would usually let the database do the initial restriction
something like this:
SELECT [Day], aoc, ryg, reasoning, notes
FROM dbo.ryg_conditions
WHERE aoc ='Administration'
ORDER BY aoc ASC,[Day] DESC
Upvotes: 2