|
-
Sep 6th, 2017, 03:47 PM
#1
Creating a linked list of results?
I have a table with metadata in it that I need to present two separate but related lists for.
Code:
Table1
-----
id | value
1 | Employee_Edited
2 | Employee_Created
3 | Employee_Deleted
4 | Manager_Hired
5 | Manager_Fired
Now I have used sql functions to parse "Employee_Edited" into "Employee", "Edited":
Code:
sql query results
-----------
id | value | valueOnly | actionOnly
1 | Employee_Edited | Employee | Edited
2 | Employee_Created | Employee | Created
3 | Employee_Deleted | Employee | Deleted
4 | Manager_Hired | Manager | Hired
5 | Manager_Fired | Manager | Fired
Now I figured I could add a Distinct query and have just the "Employee" in a list but at some point I need to display the list on the webpage with each associated action. Note not all values will have the same actions.
Results 1
-----------
Employee
Manager
Then when the user selects Manager the second list will propagate to display:
Results 2
----------
Hired
Fired
I don't want to have a second db call as that would be the obvious way to solve this but not the best for performance imo.
Whats the best way to write the query for this? Using SQL and JavaScript on an MVC website
Thanks
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 7th, 2017, 03:50 AM
#2
Re: Creating a linked list of results?
Code:
Table1
------
value | action
-------------------
Employee | Edited
Employee | Created
Employee | Deleted
Manager | Hired
Manager | Fired
PK=value & action
do not put off till tomorrow what you can put off forever
-
Sep 7th, 2017, 10:14 AM
#3
Re: Creating a linked list of results?
Thanks but that's the problem. I need 2 queries out of it to produce non repeating information. Employee will have 3 pk's (id's) but I want in one list just Employee so when selected I can filter by Employee I guess as cant filter by the id since it may be one of 3 to get its associated action
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 7th, 2017, 11:41 AM
#4
Re: Creating a linked list of results?
Hi,
dont now if it's this your after
I tested this with Access with the Northwind DB
Code:
SELECT DISTINCT Customers.CompanyName, Customers.City, Customers.Country
FROM Customers
WHERE (((InParam([ContactTitle],[Type Owner,Sales Agent,Sales Manager]))=True));
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
-
Sep 7th, 2017, 01:55 PM
#5
Re: Creating a linked list of results?
not sure I understand the question? you say you've already got the sql?
That one query result you've shown is enough to display:
Employee
+-- Edited
+-- Created
+-- Deleted
Manager
+-- Hired
+-- Fired
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|