Solved

how do i write a query in MSAccess/SQL/Oracle

Posted on 2003-12-04
8
248 Views
Last Modified: 2013-12-25
how do i write a query in MSAccess/SQL/Oracle to get  
RecordNumber/SrNo along with fields of one/multiple table

for example if my query returns Name & Age of person from table, i need Counting i.e. SrNo in a seprate field
SrNo   Name      Age
1        Austin     25
2        Kalis        45
3        Peter       35
0
Comment
Question by:nirmal_4194
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 8

Expert Comment

by:MYLim
Comment Utility
1 12/04/2003 20 how do i write a query in MSAccess/SQL/O...  Unlocked VB Databases
2 11/11/2003 20 how to convert bmp file into PDF format ...  Unlocked Visual Basic
3 11/11/2003 20 sending email through VB  Unlocked Visual Basic
4 11/11/2003 20 how do i restrict user not to type more ...  Unlocked Visual Basic
5 11/01/2003 20 How do i print contents of multiline ric...  Unlocked Visual Basic
6 11/01/2003 125 how i can print data from mshflexgrid wi...  Unlocked Visual Basic
0
 
LVL 27

Expert Comment

by:Dabas
Comment Utility
Hi nirmal_4194:
Please finalise your other questions.
If you have not received reasonable answers, consider increasing the number of points.
(Suggested value of present question: 200 points)

Dabas
0
 
LVL 8

Expert Comment

by:MYLim
Comment Utility
agree with Dabas :)
0
 
LVL 29

Expert Comment

by:leonstryker
Comment Utility
I as well.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:nirmal_4194
Comment Utility
Yes, it was my mistake. now i have closed down all the qusetions except this one.
Can any one help me. I am increasing points too...
0
 
LVL 50

Expert Comment

by:Lowfatspread
Comment Utility
what do you mean by record number ?

in a database table there isn't  the concept of a physical sequence (normally exposed to the user anyway)

tell us what your table names are and the relationships between them...

 the Database systems you are interested in can be very different to actually write SQL for...

are you just wanting to interface to MS SQL Server and Oracle Databases from an MS Access Front end Database?
0
 

Author Comment

by:nirmal_4194
Comment Utility
there is two table named Port_Master, Country_Master

Port_Code    Port_Name        Country_Code
AEDXB         DUBAI              AE
INMUM        MUMBAI            IN
USNYK         NEW YORK        US


Country_Code      Country_Name
AE                       U.A.E
IN                        INDIA
US                       U.S.A

Now I need port name along with country, and also serial number or record number i.e.

SrNo          Port_Name          Country_Name
1               DUBAI                U.A.E
2               MUMBAI              INDIA
3               NEW YORK          U.S.A

i need srno as a seprate field and not physical sequence number.
b'coz i need to write this query in my VB application to retrive data in recordset and i will assign this recordset to MSHFlexgrid.Datasource property.

I hope now you will get exact idea about my need.

thanks
0
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 75 total points
Comment Utility
the general method in one statement would be

select count(*) as srno,P.Port_name, Country_name
from Port_master as P inner Join Port_Master as p1
on p.Port_code >= p1.port_code      -- this should be a >= test on the primary Key of the Port_master Table...
inner join country_master as C
on p.country_code = c.country_code
group by p.port_name,countru_name
order by 1 asc
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

12 Experts available now in Live!

Get 1:1 Help Now