Jump to content

avoiding duplicate results??


acook

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. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.