Solved

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

Posted on 2009-05-06
12
294 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now