Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

what syntax we use if we want to apply limit to any query in ms access?

Posted on 2009-05-06
12
Medium Priority
?
305 Views
Last Modified: 2012-05-06
what syntax we use if we want to apply limit to any query in ms access? like we use LIMIT keyword in mysql, what we use in ms access .

because i am using mdb as database.limit does not work for me.
0
Comment
Question by:designersx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
12 Comments
 

Author Comment

by:designersx
ID: 24322065
here is my query , please append the limit in it according to the syntax of ms access.

$sql2="select a.* from tbldistributor a inner join tblcountrydistributor b on b.distributorid=a.id where b.countryid=".$countryid   (here limit will come);

i was using limit as

$sql5="select a.* from tbldistributor a inner join tblcountrydistributor b on b.distributorid=a.id where b.countryid=".$countryid." Limit ".($page_number*10).",10";


but this does not work for me due to syntax LIMIT that does not work in ms access.
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 24322233
0
 

Author Comment

by:designersx
ID: 24322265
in this it has been said that in some databases , record number is used but that does not follow the relational DB principles.

sir this is surely not working for me. i even don't know what is the purpose of record number , is it valid. please give me another solution. i am also trying for some valid solution.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:designersx
ID: 24322298
i have got this, trying

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_20892539.html

can u please help me out looking at it.
0
 

Author Comment

by:designersx
ID: 24322327
sir i am really unable to append it in my query, please can u help me out.
0
 

Author Comment

by:designersx
ID: 24322400
i am trying it like

$sql2="select TOP $limit, 1 a.* from tbldistributor a inner join tblcountrydistributor b on b.distributorid=a.id where b.countryid=".$countryid;

but still gives error in the query.
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 400 total points
ID: 24322406
try

$sql2="select TOP ($limit) a.* from tbldistributor a inner join tblcountrydistributor b on b.distributorid=a.id where b.countryid=".$countryid;
0
 

Author Comment

by:designersx
ID: 24322459
it is working but i don't know why it is showing me the same record.
means the record which is present on the 3rd page should be shown on clicking the 3rd link but it shows the same record but it is showing the records according to the limit that i am giving, that is fine.

can u please tell me the problem where it is?
0
 

Author Comment

by:designersx
ID: 24322580
the problem is coming because when i click on the page 1 , then page_number=1 is not going in the url . do can u tell me what should i do to solve this?
0
 

Author Comment

by:designersx
ID: 24323403
pratima_mcs sir, $sql2="select TOP ($limit) a.* from tbldistributor a inner join tblcountrydistributor b on b.distributorid=a.id where b.countryid=".$countryid;

this query works but it is selecting all the records from the top, this is the problem i am facing. 1 on page 1 , 2 on page 2 from the top, 3 on page 3. and so on.
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 24323548
yes , I have looking for the soultion
but as per my knowledge i don't think it is posible in access database
0
 

Author Comment

by:designersx
ID: 24324383
ok
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question