PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 11th, 2012, 01:00 PM
mitchelljj mitchelljj is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 2 mitchelljj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 42 sec
Reputation Power: 0
How would I have a field updated sequentially based on a defined where clause order

I want to be able to update a field sequentially based on the order that it was put in the where in ('[john2].[john2]','[john3].[john3]','[john].[john]') clause but it does not appear to update based on its associated order (see SQL below).
How would I have a field updated sequentially based on a pre-defined where clause order?

John

drop sequence temp_seq;
create temp sequence temp_seq;

update gis_field_configuration_bycube
set seq_in_grid = nextval('temp_seq')
where cube = 'Instruments' and level_unique_name in ('[john2].[john2]','[john3].[john3]','[john].[john]');

Reply With Quote
  #2  
Old September 18th, 2012, 10:01 AM
debasisdas's Avatar
debasisdas debasisdas is offline
Humble Learner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Location: Bangalore, India
Posts: 279 debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3
Time spent in forums: 2 Months 3 Days 4 h 48 m 5 sec
Reputation Power: 118
Send a message via ICQ to debasisdas Send a message via AIM to debasisdas Send a message via MSN to debasisdas Send a message via Yahoo to debasisdas Send a message via Google Talk to debasisdas Send a message via Skype to debasisdas
Instead of adding those strings in the IN clause, take those in a cursor and run the update by passing the values from the cursor. That will definitely help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > How would I have a field updated sequentially based on a defined where clause order

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap