Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
whovind
Newbie


Joined: 11 Nov 2002
Posts: 5
Location: Canada

PostPosted: Wed Nov 20, 2002 8:04 pm   

Finding Duplicates with %Query
 
I'd like to only add records to a DB when the record doesn't already exist. At some point perhaps do updates as well. The problem is the unique "key" as far as the mud is concerned isn't the name but a combination of all/many of the fields.

I've looked at query and I can't seem to get it to work with strings. In a perfect world I'd have something like:

#IF {%query(((&HITROLL<>@NewItem.HITROLL)OR(&DAMROLL=@NewItem.DAMROLL) OR(&Name=@NewItem.Name),ALL) }
{ insert code here }

Is this possible?

Thanks,

Piedtyper
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 20, 2002 11:34 pm   
 
If %query doesn't work well for your application, do something else.

#VAR new 1;#VIEW ALL;#DBFIRST;#LOOP %numrec() {#IF ((&HITROLL <> @NewItem.HITROLL) OR (&DAMROLL = @NewItem.DAMROLL) OR ({&Name} = {@NewItem.Name})) {} {#VAR new 0};#DBNEXT};#IF (@new) {insert code here}

LightBulb
Senior Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net