[Help] query in sql

05/31/2011 17:10 Svinseladden#1
there is some easy query's already in this forum. but i hope some will share there other too. or i have one i realy want and can't make for mye self.

when you get a username that has payed for points (AP) (DP) and so on

is there a query to add to already points. so i don't just change it to 70 000 if he already have 20 000 and pays for 70 000.

i want something to add 70 000 to 20 000 so i get 90 000 and not just change it to 70 000 and all the points he/she hade is gone.

i don't know the query for add to already unknown point

i already have alot of query's and i found out how to change some of them to how i want it:-)

(i can share what i found out. if anyone have a better working stuff please share)

like:

UPDATE dbo.MobItems
SET Grade = 'x'
WHERE Grade = 'x'

i use this when i start and have alot of grades past 998 to just change it to a normal working grade

this can be changed in any way possible like:

UPDATE dbo.x where x is what dbo you want to work in
SET x = 'x' here you can put in anything you want to set in that dbo
WHERE x = 'x' here you can put in anything you already now in that dbo.

it's easy. or was for me:-)

and if you want to know what items you have in what grade? just use

select * from ps_gamedefs.dbo.items
where grade= 'x' where x is the grade you want to check

here to you can search in any way you would ever need to check where what is. like what mob have what grade?

select * from ps_gamedefs.dbo.MobItems
where grade= 'x' what grade your looking for.

and finaly i use this ti add item to a grade i already have

UPDATE ps_gamedefs.dbo.items
SET Grade= '0'
WHERE ItemID= '0'
OR ItemID= '0'
OR ItemID= '0'
OR ItemID= '0'
OR ItemID= '0'
OR ItemID= '0'

lets say 968 have armor for lvl 70 and i have forgot the gloves that has the id 23456 (not the right number)

this would look like:


UPDATE ps_gamedefs.dbo.items
SET Grade= '968'
WHERE ItemID= '23456'
and run the query and your done.

let's say you all the mobs that have grade 450 drop too litle and you want to raise the droprate you can use this too

UPDATE dbo.MobItems
SET DropRate = 'x' what you want to change it too
WHERE Grade = 'x' what grade you want to change the droprate on.

PS: remeber this does this with all the mobs that have that grade..

hope this helps
05/31/2011 17:51 darkmanx1986#2
This should do :

Code:
USE PS_UserData;
UPDATE Users_Master
SET Point = (Point + 3000)
WHERE UserID = 'UserID'
05/31/2011 17:59 Svinseladden#3
Quote:
Originally Posted by darkmanx1986 View Post
This should do :

Code:
USE PS_UserData;
UPDATE Users_Master
SET Point = (Point + 3000)
WHERE UserID = 'UserID'
ty so much:-)
05/31/2011 19:57 abrasive#4
Be careful with that, if there is a deleted toon with that same name on another account, the other account will also receive the points.

I'd recommend going by UserUID when doing that
05/31/2011 20:44 castor4878#5
deleted or not - checking duplicate name upon creation is optional.
but explain this to someone who has just learned the addition can be a bit complicated.
06/01/2011 10:17 Svinseladden#6
i was sure this did go after userId and not char id?
06/06/2011 09:48 ac1dtab#7
heres a creat procedure to make for your database to give out points buy simply eecuteing the quary after you creat it all you input is the userid (accountname) and points to give...


USE [PS_GMTool]
GO
/****** Object: StoredProcedure [dbo].[IPBan] Script Date: 06/06/2011 00:39:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*================================================= =
@author [DEV]xXDASHXx
================================================== */
create Proc [dbo].[DonationPointHandout]
@UserID VARCHAR(100),
@Point INT

AS

UPDATE PS_UserData.dbo.Users_Master SET Point=ISNULL(Point,0)+@Point
WHERE UserID=@UserID


SET NOCOUNT OFF