Jump to content

Recommended Posts

Does anyone know if this is possible:

 

I'm running a query against a db and am pulling name and ticket # (for a helpdesk)...  What I'd like to do is take the results from the "Name" field, but only show EACH NAME ONCE in a table.  For example, I might get 200 results back, but only want to show the name of the person once, with how many tickets they have assigned to them.

 

So it would look like this:

 

___Name___|___Number of tickets___

___Bob____|__________3__________

___John____|_________23__________

___Mark____|_________4___________

 

...etc, etc...  does anyone know how to go about starting this?  I'm assuming an array of sorts.  Any help would be appriciated!  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/64099-avoiding-duplicate-results/
Share on other sites

Hmm, I'm not sure I understad.  This is my query now:

 

$query = "SELECT Create_Date, Request_Type, Assignee_Group, Assignee_Individual, Status, Request_Task_ID FROM Request_Task WHERE (Status='Active' OR Status='Assigned' OR Status='Acknowledged' OR Status='Held' OR Status='Pending' OR Status='Pending Cancellation' OR Status='WIP') AND (Assignee_Group='Security')";

 

So I would want to isolate "Assignee_Individual" and I guess count how many of each type of ticket that person had.  And the table would look like:

 

___NAME___|___Assigned___|___Acknowledged___|___Held___|___Pending___|___WIP___

  Mark                  5                          6                      11            3                    5

 

 

Could that same query be rewritten the way you suggested?  I guess I wasn't clear enough.  It seems like some math would need to happen. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.