Solved

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

Posted on 2009-05-06
12
296 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

910 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

21 Experts available now in Live!

Get 1:1 Help Now