If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Trying to get info from these results, what should my query look like?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-06, 15:08
purpendicular purpendicular is offline
Registered User
 
Join Date: Mar 2004
Location: Rhode Island, USA
Posts: 55
Trying to get info from these results, what should my query look like?

In the attached photo, you will see the query in the background, and the results in the foreground.
What I would like to do is get a count of each of the matching prodkeys so I can see how many have been used and compare them to my total number of software licenses
I'm searching on the pc software table using the software title to get the current list. I have a havelicenses table that stores the software titles and how many licenses for each. Some titles have a license key good for 5 users and another license key (for the same title) for 10 users. So the idea is to account for software, and when adding new software to see if there is a license key for it, if the key is at it's limit and be notified wether we can or can not use it in another pc.
Ex.
I have a total of 15 licenses for a piece of software.
I have 2 licenses for this software
License key 1 is good for 5 users.
License key 2 is good for 10 users.
If I have 3 pc's using key1 and 7 pc's using key 2
I want to show the user that there are 2 more left for license key 1
and 3 left for license key 2
The user will be able to choose one of the keys to use for the software install.

Am I being too confusing?
I could use some help please.
Thanks,
Ray
Attached Thumbnails
Trying to get info from these results, what should my query look like?-queryhelp.jpg   Trying to get info from these results, what should my query look like?-screen.jpg  
Reply With Quote
  #2 (permalink)  
Old 08-10-06, 18:58
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
The query to get a count of each prodkey that matches your app name would look like this -
Code:
SELECT prodkey, count(*) FROM installed_sw WHERE app = 'colname' GROUP BY prodkey
It basically takes your query and groups the rows by the prodkey and counts how many rows are in each group.
Reply With Quote
  #3 (permalink)  
Old 08-11-06, 10:56
purpendicular purpendicular is offline
Registered User
 
Join Date: Mar 2004
Location: Rhode Island, USA
Posts: 55
So grateful, thank you!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On