Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase 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 Codewalkers Forums Sponsor:
  #1  
Old October 3rd, 2003, 03:51 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
sql help

The query below works BUT i am trying to use the logic in a update statement. So the limit has to go. can anyone help get first 4 rows without using the limit?

SELECT tabA.colA
FROM tabA, tabB
WHERE tabA.colC = 1
AND tabB.colD >= 4
AND tabA.colA > 0
limit 4

Thanks

Reply With Quote
  #2  
Old October 3rd, 2003, 04:58 PM
opus006 opus006 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 65 opus006 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: sql help

Whish SQL?

MySql:
UPDATE tabA, tabB
SET tabA.someCol = someValue
WHERE tabA.colC = 1
AND tabB.colD >= 4
AND tabA.colA > 0
LIMIT 4;


Reply With Quote
  #3  
Old October 3rd, 2003, 07:12 PM
-vertigo- -vertigo- is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Louth, Lincolnshire
Posts: 314 -vertigo- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 24 sec
Reputation Power: 2
RE: sql help

If you don't want to do that you could probably get the id's of the first four rows and then use those id's when updating them.

You should lock the tables if you do this, however, so I think the previous suggestion is better.

Reply With Quote
  #4  
Old October 13th, 2003, 03:56 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: sql help

i need help . i would like to know how to add an id into 2 tables. what i mean is i want to add an id into a table name " mb01lnum ". and then i want use the id to insert into another table name " mb02mklmbls " .

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > sql help


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT