ShawnMolloy
MIS
would like to verify that the record I'm going to insert is going to unique based on selected columns.
Here is my query:
I want to insert only as long as there is not a row that already contains this duplicate
- userid
- friendid
- statcode
unless that friendId is not = -1, as that is my null marker
Just for refence this is the code I'm calling this procdue from (c#)
I'm tryign to build a stats engine and want to only record unique hits. What is the best way to accomplish this is SQL?
Thanks!!!
Shawn Molloy
Seattle, WA
Here is my query:
Code:
INSERT into stats
(statcode,dateandtime,userid,friendid)
values
(@statcode,@dateandtime,@userid,@friendid)
I want to insert only as long as there is not a row that already contains this duplicate
- userid
- friendid
- statcode
unless that friendId is not = -1, as that is my null marker
Just for refence this is the code I'm calling this procdue from (c#)
Code:
public static void AddStat(int userId, StatType statType)
{
... //do insert
}
public enum StatType
{
Login = 0,
View = 1,
}
I'm tryign to build a stats engine and want to only record unique hits. What is the best way to accomplish this is SQL?
Thanks!!!
Shawn Molloy
Seattle, WA