Solved

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

Posted on 2009-05-06
12
301 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

740 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