If I have a file of 100,000 products and I want to page them in a list of 100
on my website sorted by product name in attribute 1.
SELECT PRODUCTS BY A1
This would return me all 100,000 products.
So what would be my query when the website loads and I only want the 1st 100 by
product name.
Then the user would click the "Next" button to display the 2nd 100 (101, 200).
What would be my query then?
Would I always have to perform the full select and return 100,000 records and
then loop through and only show records 101 to 200.
Isn't there a better way so that you only return the 100 records you want to
view.
Regards
Adrian Halid
Senior Analyst/Programmer
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P: (08) 9315 7000 F: (08) 9315 7088
E: [email protected] W: http://www.itvision.com.au
___________________________________________________________
NOTICE : This e-mail and any attachments are intended for the addressee(s) only and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any attachments) by an
unintended recipient
is prohibited. If you are not the intended recipient please contact the sender
as soon as
possible by return e-mail and then delete both messages.
___________________________________________________________
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dan Fitzgerald
Sent: Friday, 19 February 2010 9:29 AM
To: 'U2 Users List'
Subject: Re: [U2] TOP/LIMIT Equivalent?
You could save the list, and edit it. But, really, there will be no logical
relationship between these records. The 1st hundred is just as random as the
2nd or 3rd hundred, unless your modulus is an extremely ill-advised one.
Again, they are hashed records. What we mean by this is that UV will take
your item id, extract a numeric equivalent from it (i.e., a238rs45 becomes
23845), then divides by the modulo (a simplification, but reasonably
illustrative for our purposes). It takes the resulting remainder (if your
modulus was 101, this will be 9), adds 1 (because you can have a remainder
of 0), and puts that record into group #10. Unless you know your precise
hashing algorithm (which was proprietary, last time I checked), you simply
don't know where the record will land. (OK, if you have sequential numeric
id's, and you use group.stat.detail to analyze the file, you might be able
to predict it, but whatever algorithm you cook up goes out the window if you
resize or change the file type, and that's a lot of unnecessary work,
anyway). If you want a random sample, use SAMPLE. If you need a logically
related group (the last 100 records added, for example), then you should
apply selection criteria (SSELECT FILE WITH TIMESTAMP GE xxxx BY-DSND
TIMESTAMP). The logic is in the data.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Adrian Halid
Sent: Thursday, February 18, 2010 8:06 PM
To: U2 Users List
Subject: Re: [U2] TOP/LIMIT Equivalent?
But how would you get the 2nd 100 (101 - 200) and the 3rd 100 (301 to 400)
without writing a subroutine to do it?
Regards
Adrian Halid
Senior Analyst/Programmer
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P: (08) 9315 7000 F: (08) 9315 7088
E: [email protected] W: http://www.itvision.com.au
___________________________________________________________
NOTICE : This e-mail and any attachments are intended for the addressee(s)
only and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any attachments) by an
unintended recipient
is prohibited. If you are not the intended recipient please contact the
sender as soon as
possible by return e-mail and then delete both messages.
___________________________________________________________
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of [email protected]
Sent: Friday, 19 February 2010 4:55 AM
To: [email protected]
Subject: Re: [U2] TOP/LIMIT Equivalent?
In a message dated 2/18/2010 10:27:46 AM Pacific Standard Time,
[email protected] writes:
You can sort first and then SAMPLE, too.>>
Caryl has the idea here if you really want the "Last" 100.
You can Sort BY-DSND which means "by descending" so if you want the last
alphabetically or the last by ID or the last by some other field you can
sort
on that and then Sample 100 ? I've NEVER tried this. Does it work?
If that doesn't work you can EXECUTE a sort by dsnd and then simply write a
brief BASIC routine to pull off the "first" 100 of that list and output it!
Will "Where There's a Way there's a Will... or something" Johnson
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users