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
Solved

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

Posted on 2009-05-06
12
299 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
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

856 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