Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Displaying Conditional Database Data
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Displaying Conditional Database Data

 Post Reply Post Reply
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Topic: Displaying Conditional Database Data
    Posted: 27 February 2009 at 9:34pm
Hello,
 
I am working on a simple webpage to track and edit assets. I have the database and the basic code out of the way so that I can have one page that will display every asset and information about it.
 
I would like to be able to switch to a department view, where, obviously, each device in the particular department will be displayed. I would also like to be able to display a total count of each specific model number.
 
This is ran on an Access database. I have been messing around with Access trying to figure out how to make, say, a table for each department that receives it's data from the main table (the one that includes every single asset). Is there no simple way to just make a table take data from another, the way you can reference cells in Excel?
 
I set up a query to count each model number. That was fairly simple, but how do I force that query to spit that data out into a separate table? Or is it possible to use ASP to display data in a query the same as it would from a table (know what I mean?)?
 
Or, instead of making Access do all of the work, which just seemed easier to me at first, can I filter for certain data in the database using ASP and display only the rows that would contain a cell that reads, DEPARTMENT A or DEPARTMENT B? Something like that?
 
I hope I posed my questions good enough and didn't make them too confusing.
 
 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2009 at 9:39am
In SQL Server you can make a view which represents a virtual table created from the data of other tables. Not sure though if this is available in Access.

However you should be able to construct an SQL Query that pulls only the data you need from a single or multiple tables.

For example in your case you could have:-

SELECT * FROM table_name WHERE field_name = 'DEPARMENT A';
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2009 at 6:44pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

In SQL Server you can make a view which represents a virtual table created from the data of other tables. Not sure though if this is available in Access.

However you should be able to construct an SQL Query that pulls only the data you need from a single or multiple tables.

For example in your case you could have:-

SELECT * FROM table_name WHERE field_name = 'DEPARMENT A';
 
That worked easily! Thank you so much!
 
Is there a way that I could count how many instances of particular entries that I have? For instance, if I want to know how many of a certain model we have. Could I add in a function to give the sum of how many times "Model XX01" appears in the column named "Models"?
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2009 at 10:14pm
see this page on w3schools.com
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2009 at 9:27pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

In SQL Server you can make a view which represents a virtual table created from the data of other tables. Not sure though if this is available in Access.

However you should be able to construct an SQL Query that pulls only the data you need from a single or multiple tables.

For example in your case you could have:-

SELECT * FROM table_name WHERE field_name = 'DEPARMENT A';
 
I've not been able to figure out how to filter by two different columns. I've tried
 
SELECT * FROM table_name WHERE field_name = 'DEPARMENT A', WHERE field_name = 'PRODUCT_TYPE B';
 
I've also tried it without the comma, without the "WHERE" and all of that. Would you mind telling me how to properly do this?
 
Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.