Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jeyinula
Starting Member
2 Posts |
Posted - 2011-06-21 : 00:49:57
|
| Hi All,Please help me on following query.There are two tables and i am selecting four columns from first table and one column from second table.table1 : code, priority,statustable2 : statusthe values of status in table1 and table2 are same.No i want the output based on priority wise. code is for count.for ex:"PRIORITY" 'STATUS' CODE"Critical" 'Closed' 1 'Deferred' 2 'Fixed' "High" 'Closed' 4 'Deferred' 5 'Fixed' 7 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-06-21 : 06:56:58
|
Would you even need the second table? And would just a simple "ORDER BY" clause get you what you need?select code, priority, statusfrom yourTableWith3Columnsorder by status |
 |
|
|
jeyinula
Starting Member
2 Posts |
Posted - 2011-06-21 : 07:09:49
|
| Hi sunitabeck,Thanks for your reply.table2 is a masterlist (dropdown) and its having the status values like "New", Deferred, Closed, Deferred etc....Selected values from dropdown will store in table1 under status column.Now, i have to group the values by Status of table2.LikeNew Critical 1 High - Medium 2Open Critical 1 High - Medium 2Closed Critical 1 High - Medium 2I want like that. |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-06-21 : 07:32:28
|
I am afraid your description is not quite clear to me to respond with something useful. If you have a drop-down in your user interface where the user can pick a status and you want to display the result of the user selection, then you would need to do the following:1. Get the value the user selected in the user interface.2. Send a query to the database with the selected value of status3. Have a query in the database which is something like this:select code, priority,statusfrom YourFirstTablewhere status = @userSelectedStatus Here @userSelectedStatus is the status the user selected.If you are using a .Net based front-end, you may also want to google for complex data binding which can make it a little easier to manage. (In spite of the name, complex data binding is rather simple to implement). |
 |
|
|
|
|
|
|
|