Showing posts with label thisid. Show all posts
Showing posts with label thisid. Show all posts

Monday, March 26, 2012

how to setup this query?

hi,
i have a table which has an ID, Time (unix time in seconds), and a score. th
e data looks something like this:
ID Time Score
1 1079748053937 1.0
2 1079748053945 0.67
3 1079748053945 0.32
4 1079748053945 0.01
5 1079748053950 0.90
6 1079748053950 0.1
my problem is that i want to write a query that will get the highest score a
t a given time. can anyone offer any help'
thanks!If I understand what you want, the highest score for each
time can be obtained with something like:
select time, max(score)
from your table
group by time
-Sue
On Mon, 22 Mar 2004 11:51:14 -0800, "mike"
<anonymous@.discussions.microsoft.com> wrote:

>hi,
> i have a table which has an ID, Time (unix time in seconds), and a score.
the data looks something like this:
>ID Time Score
>1 1079748053937 1.0
>2 1079748053945 0.67
>3 1079748053945 0.32
>4 1079748053945 0.01
>5 1079748053950 0.90
>6 1079748053950 0.1
>my problem is that i want to write a query that will get the highest score
at a given time. can anyone offer any help'
>thanks!

Monday, March 19, 2012

how to set these varibles? help

I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
The table(s) goes like this:
Id f1 f2 f3 f4 ... f10
1 apple pear pineapple orange
2 chinese english greek britan...
...
Now I want to set only one variable to get the value of these fields:
I wrote like this:
declare @.m int,f@.m nvarchar(50),i int
set @.m=1
set @.i=1
set f@.m=(select f@.m from s where id=@.i)
It seems that sql doesn't support such way of declare. What can I do?
Thanks in advance!
Just a quick hint - why don't yo simply use a table data type variable?
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"treesy" <treesy@.hostran.com.cn> wrote in message
news:equEgdcsEHA.2660@.TK2MSFTNGP12.phx.gbl...
> I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
> The table(s) goes like this:
> Id f1 f2 f3 f4 ... f10
> 1 apple pear pineapple orange
> 2 chinese english greek britan...
> ...
> Now I want to set only one variable to get the value of these fields:
> I wrote like this:
> declare @.m int,f@.m nvarchar(50),i int
> set @.m=1
> set @.i=1
> set f@.m=(select f@.m from s where id=@.i)
>
> It seems that sql doesn't support such way of declare. What can I do?
>
> Thanks in advance!
>

how to set these varibles? help

I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
The table(s) goes like this:
Id f1 f2 f3 f4 ... f10
1 apple pear pineapple orange
2 chinese english greek britan...
...
Now I want to set only one variable to get the value of these fields:
I wrote like this:
declare @.m int,f@.m nvarchar(50),i int
set @.m=1
set @.i=1
set f@.m=(select f@.m from s where id=@.i)
It seems that sql doesn't support such way of declare. What can I do?
Thanks in advance!Just a quick hint - why don't yo simply use a table data type variable?
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"treesy" <treesy@.hostran.com.cn> wrote in message
news:equEgdcsEHA.2660@.TK2MSFTNGP12.phx.gbl...
> I have a serious of fields like: f1, f2, f3,f4,f5,f6,f7,f8,f9,f10
> The table(s) goes like this:
> Id f1 f2 f3 f4 ... f10
> 1 apple pear pineapple orange
> 2 chinese english greek britan...
> ...
> Now I want to set only one variable to get the value of these fields:
> I wrote like this:
> declare @.m int,f@.m nvarchar(50),i int
> set @.m=1
> set @.i=1
> set f@.m=(select f@.m from s where id=@.i)
>
> It seems that sql doesn't support such way of declare. What can I do?
>
> Thanks in advance!
>