Microsoft
Software
Hardware
Network
Question : Choosing the right constraint with the select query
I have a table that has ~1.000.000 rows and it is getting bigger.
The table has a column called IPAdress.
Here is what i want to do:
I will assign 192.168.1.12,192.168.1.13 to User1.
And i will assign 192.168.1.12 to User2 too.
So when User2 runs a query it will only bring the results that have the IpAddress=192.168.1.12
Because User2 is not allowed to see results from other ip addresses.
Now, i am not sure about how to do this fast and accurate.
Please help me to design a solution.
ps: Currenly i am doing this:
When User1 runs a search query in my table, i run
select * from myTable
where IPAddress='192.168.1.12' or IPAdress='192.168.1.13'
But in practice a User can have a right to see more than 100 ip addresses so it means
where IPAddress = will contain lot of '...' or '...' ..... or strings.
And i am sure this is not the right way to do this.
Thank you .
Answer : Choosing the right constraint with the select query
why don't you use IN clause? either with temp table or sub query or make dynamic string
Random Solutions
Using web service in javascript for asp.net ajax-enabled web site
Sending and Receiving Data like a Dataset using WCF between two or more programs over internet without IIS Configurations
MS Access - Move focus from one form to another form with VBA and enable controls
Unicode/STL/Varargs problem
split comma delimited values into seperate columns
Access 2007 converts all my projects to .mde when I save to local drive
How Do I Test If A PivotItem Exists?
Cascading Combo Boxes on a Form (Access 2007)
Domain controller for Group Policy operations is not available. and a couple other things.
Disable Compatibility Checker Excel 2007