[Phpwm] incrementing values during an update

phil at infolinkelectronics.co.uk phil at infolinkelectronics.co.uk
Wed Sep 16 14:57:01 UTC 2009





> -----Original Message-----
> From: phpwm-bounces at mailman.lug.org.uk
> [mailto:phpwm-bounces at mailman.lug.org.uk]On Behalf Of alan dunn
> Sent: 16 September 2009 15:39
> To: phpwm
> Subject: [Phpwm] incrementing values during an update
> 
> 
> I want to update a sub-set of records in a sql table. three of the 
> values are fixed.
> 
> 'devcount' I want to increment starting from 1 each time the query is 
> run for a new $q_batch:
> 
> UPDATE tblprintq SET q_printed = 'A', printer = '$printer', conbatch = 
> $condbatch, devcount = ??????
>  WHERE q_batch = $q_batch
>  AND q_printed = 'N'
> 
> I can do it by doing a SELECT to get the row ID, then incrementing a 
> counter, then running an UPDATE on row ID, but is there a way of doing 
> this within the query?
> 
> Thanks, alan dunn


SET devcount=devcount+1 

Regards,

Phil Beynon
Sales & Operations Director

** Infolink Electronic Systems Ltd.
** S/W Birmingham's Longest Established ISV & VAR
** http://www.infolinkelectronics.co.uk
** Professional Web 2.0 Design & Advanced Hosting Platforms
** http://www.coeus-computica.co.uk
** Affordable Knowledgebase Solutions
** Contact: Sales at infolinkelectronics.co.uk
** Tel / Fax 0121 441 3558
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Phil Beynon.vcf
Type: text/x-vcard
Size: 636 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/phpwm/attachments/20090916/bd7cac20/attachment.vcf 


More information about the Phpwm mailing list