Search the Community
Showing results for tags 'distinct'.
Found 3 results
Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
I am wondering why this is not working. I have a table of order line items. each order can have multiple line items with the same transaction ID just different item codes. I am trying to find single transaction ID's with a specific item code. I also tried doing a count (transactionnumber)<2 but could not figure out how to add a where for the item number. So an order for just this item select distinct(transactionnumber) from Orders (I thought this would select any unique transaction number IE only one occurance)where Code='9987' When I run the above and check the transaction numbers it is any transaction with that code not transactions with only that code? I also tried this select * from OrdersWhere (select COUNT(transactionnumber)from Device_Orders) <2 and ItemCode='9987' This returns no records when I know there are single transaction numbers with that item code? Any suggestions would be appreciated
Hey Everyone, I am fairly new to SQL and pulling out whatever little hair is left on my head. I have a data dump where we are trying count the "First Call Resolution" for tickets that an employee opens and closes himself. The company is using MS Access and I am working with a basic data dump from the ticketing system. I have already weeded out everything I don't need, but I'm having trouble trying to compare and count two rows in the same table. Here is an example of the info in the table ticket_number | agentID | activity | notesGLOB-1234 | tier1_A1 | OPENS | ticket openedy by tier1_A1 - BobGLOB-1234 | tier1_A1 | REMRK | helped client fix their stuffGLOB-1234 | tier1_A1 | CLOSE | ticket closed by tier1_A1 - BobGLOB-1235 | tier1_A2 | OPENS | ticket openedy by tier1_A1 - Chris GLOB-1235 | tier1_A2 | REMRK | Could not resolve issue, routing to tier 2GLOB-1234 | tier2_A2 | REMRK | Recevied ticket from tier1, fixed problem remotely, advised clientGLOB-1234 | tier2_B1 | CLOSE | ticket closed by tier2_A2 - Mike I want to be able to check the table to see how many ticket tier1 agents have resolved on their own. In order to do this, I just have to count the number of times that I have a row where ticket_number, agentID are the same, and where Activity = 'open' and activity = 'close'. I want to make the solution simple and elegant and try and do it within the same table. I guess one other option would be to create two separate views a then compare the two tables to each other? Please help me!!!Thanks in advance