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)
 Cross-tab type query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-24 : 13:06:20
Mark writes "I am trying to do a cross-tab select query in SQL(7) from a table with a structure like this...

logId
VariableName
VariableData

the table is happily logging stats from an application but it never knows how many variables it needs to log for a given logId (otherwise i would have used another table to normalise it).
At least one variable is always logged, like a timestamp.

The kind of results i want would look like this...

logid     timedate      referer       variable_c
1 1/1/01 john 0
2 2/1/01 2
3 2/1/01 jenny 3
4 2/1/02 jane 1


I dont need all of the possible variables, just one or two that sometimes exist, like the referer variable above.

the microsoft access cross-tab query wizard does exactly what i want to do (apart from including all the variables for a given logId).
Can this be done with a SQL query without resorting to temporary tables?

Thanks in advance

Mark"
   

- Advertisement -