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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 please help me on this Tricky SQL

Author  Topic 

kulkarni_ajit
Starting Member

4 Posts

Posted - 2009-02-23 : 03:49:19


Hi,
Import the table structure attached along with the data.
What we are trying to achieve here is that we need to have a search which will give me group where the matching values will be available for eg.
I will give search
1. Location = ‘Pune’ and Year = ‘10/10/10’
Then the query should give me groups 175,177
2. Location != Pune and Year =’10/10/1010’
Query should return me group 176
3. Location = Pune AND time = ’11:11:11’ AND Year = ‘10/10/1010’
Query should return me group 177
4. Company != Oracle
Query should return me 179 and 180

So what we are trying to do is that we are creating the table structure dynamically and the corresponding values for each column the columns are user defined.

We did try using Having clause but it is not working for multiple rows ?

Please let us know if you need more inputs
can i do in Single SQL
please help me out
Regards
ajit

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-23 : 04:49:22
Yes you can do this in a single query.
Why are you using a EAV data model?

See this blog post how to post sample data
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -