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
 Old Forums
 CLOSED - General SQL Server
 sum / count function

Author  Topic 

mateenmohd
Constraint Violating Yak Guru

297 Posts

Posted - 2007-05-29 : 02:29:31
we use following query.

select safetyvideo2007.user_id,safetyvideoview.user_id,
safetyvideoview.name,safetyvideo2007.vdate,safetyvideo2007.video1,safetyvideo2007.video2,
............
from safetyvideo2007,safetyvideoview
where safetyvideo2007.user_id=safetyvideoview.user_id
order by safetyvideoview.name, safetyvideo2007.vdate asc


upto video44 fields

table1
---------------
user_id varchar
video1 varchar
video2 varchar
...
video44 varchar

table2
---------------
user_id varchar
name varchar


could we use sum / count function in above query that
how many video view by the ecah user ?

we have 44 safety video (15 minutes), user have to view
these videos in different date.

regards
Mateen


harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-29 : 02:36:14
You need to normalize your table structure, mate. Your table does not seem to be even in 1st normal form.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

mateenmohd
Constraint Violating Yak Guru

297 Posts

Posted - 2007-05-29 : 02:51:19
thanks for response.

data inserting by asp program, in asp we could not insert 44 video name in one field
hece I store 44 video name in 44 fields. nvarchar datatype also not support sum / count
function. any other way / procedure could support sum / count to varchar field ?



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-29 : 22:52:21
quote:
we could not insert 44 video name in one field

Then can you insert 44 records into a table ?
Your table should be basically

table1
---------------
user_id varchar(100) <pk>
video varchar(100) <pk>



KH

Go to Top of Page

mateenmohd
Constraint Violating Yak Guru

297 Posts

Posted - 2007-05-30 : 04:07:49
thanks for response.
yes, then we can insert 44 record into a table.

table1 no <pk>
----------------------
user_id varchar
video1 varchar
video2 varchar
...
video44 varchar

table2
---------------
user_id varchar(100) <pk>
name varchar (100) <pk>

table1 using only to insert user_id and number of video view record.
multiple users inserting the multiple video record into table1.

regards
Mateen




Go to Top of Page
   

- Advertisement -