DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

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:
  #16  
Old May 29th, 2004, 08:50 PM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
Ok, good, I am then relieved. IBM finally awoke from a deep slumber where their tunnel vision saw only Java and mainframe applications a couple of years ago. Now they are offering deep integration into the .NET development environment and embracing also open source. Linux, PHP, etc.
amazing...

Anyway - that DB2 cookbook I referenced earlier is a pretty good quick ref

fv
__________________
...because that is the way we have always done it. We've been doing it like that for 80 Years! (How do we change that mindset?)

Reply With Quote
  #17  
Old June 2nd, 2004, 11:20 PM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
Good! So how are the DB2 expolrations going so far?
Perhaps a little different syntax with some things such as limiting queries to X records or getting the last inserted ID
and such...

fv

Reply With Quote
  #18  
Old June 3rd, 2004, 07:32 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 27 m 47 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Quote:
Originally Posted by fractalvibes
Good! So how are the DB2 expolrations going so far?
Perhaps a little different syntax with some things such as limiting queries to X records or getting the last inserted ID
and such...

fv
You can limit queries to X number of records easily enough, but you can't limit like in MySQL. With DB2, you can't fetch any number of records from the top down.
i.e.
select * from some_schema.some_table fetch first 100 rows only
This would return the first 100 rows from the resultset instead of the entire resultset.

Reply With Quote
  #19  
Old June 3rd, 2004, 08:20 AM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
Sure you can -
select colA
, colB
, colC
, colD
from mytable
order by colB
fetch first 100 rows only

should do the trick.

fv

Reply With Quote
  #20  
Old June 3rd, 2004, 08:46 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 27 m 47 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
fractalvibes, why are you posting an answer to a question you asked?!?

Reply With Quote
  #21  
Old June 3rd, 2004, 09:02 AM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
I thought I was replying to your comment about limiting the resultset to x rows in whatever order....top down, etc.

[but you can't limit like in MySQL. With DB2, you can't fetch any number of records from the top down.
]

fv

Reply With Quote
  #22  
Old June 3rd, 2004, 09:26 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 27 m 47 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
You can limit, but not like the full functionality of mysql.
MySQL allows you to pick a section out of the resultset that doesn't always start with the first row.
i.e. select * from some_table limit 50, 10
That would pull out ten records from the resultset starting at row 50.
Your response to my post included the very same thing I posted in the first place.
i.e. the use of fetch first 100 rows only.

Make any sense?

Reply With Quote
  #23  
Old June 3rd, 2004, 10:56 AM
fractalvibes fractalvibes is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Location: Waco, Texas
Posts: 632 fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level)fractalvibes User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 14 h 11 m 13 sec
Reputation Power: 22
Ah, ok - had forgotten about that MySQL functionality...that would be tricksy in DB2.

fv

Reply With Quote
  #24  
Old May 31st, 2005, 12:47 PM
Jj1377 Jj1377 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 Jj1377 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 36 sec
Reputation Power: 0
PhP MySQL, Linux to AS/400 DB2

hello everyone,

I need to know how to pull records dynamically from a DB2 database on an AS/400.

Regarding this post by Onslaught
You can limit, but not like the full functionality of mysql.
MySQL allows you to pick a section out of the resultset that doesn't always start with the first row.
i.e. select * from some_table limit 50, 10
That would pull out ten records from the resultset starting at row 50.
Your response to my post included the very same thing I posted in the first place.
i.e. the use of fetch first 100 rows only.

...ok so my question is

how can i achive the same MySQL functionality in DB2? I am using PhP/Linux that is connecting to an AS/400 DB2 on our local network.

I want to be able to limit records per page with resultssets starting with 10, 20, 30, 40 (10 per page)
i.e. select * from some_table limit 50, 10


Thanks guys,
Jj1377

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > DB2: Book suggestions?


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 1 hosted by Hostway