If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Selecting a specific row from SQL ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-03, 16:39
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
Selecting a specific row from SQL ?

im in vb
doing a select statement
im trying to pull a specific row "where row = ... " as apposed to do a "where something = something" from a field

anyway to do that

basically im sending a selected itemindex from a combobox and that item number i am trying to pull from the db (access)

thnx
__________________
Beyond Limitation
Reply With Quote
  #2 (permalink)  
Old 02-05-03, 16:04
Memnoch1207 Memnoch1207 is offline
Registered User
 
Join Date: Jan 2003
Location: Midwest
Posts: 138
SELECT * FROM tablename WHERE fieldname = datawanted
Reply With Quote
  #3 (permalink)  
Old 02-05-03, 23:19
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
that gets the row(s) of any nubmer
im looking for example
select row 5 from table
a specifc row
__________________
Beyond Limitation
Reply With Quote
  #4 (permalink)  
Old 02-05-03, 23:34
playernovis playernovis is offline
Registered User
 
Join Date: Nov 2002
Location: San Francisco
Posts: 251
OK,

the basic DB model is based on IDs, each lookup table has next to field DESCRIPTION, ... also field ID, which is usually (not all the time) automatically assigned - MS Access calles it AUTONUMBER, MS SQL server IDENTITY. This number is UNIQUE and usually should have an index. Then the main table has column with that ID and links those two tables together using that ID. Just to clear misunderstanding - you HAVE TO DEFINE THIS FIELD!

so for example:


TABLE: CUSTOMER

CustomerID unique accross table, should have index
CustomerName
Customer Telephone
...

TABLE: INVOICE

InvoiceID unique accross table, should have index
CustomerID it is not unique, should have index, points to Customer table
InvoiceDate
...


generally say you should use NUMBERS and not string as an IDs (you can of course use the string), but numbers are much much faster.


so here you can see that you don't need any row number. And tobe honest, most of the databases DO NOT HAVE row numbers. MS Access does not have it at all. Oracle does, but it has really different purpose.



then I can write a SQL

this selects all invoices and customer names
SELECT InvoiceID, InvoiceDate, CustomerName FROM
INVOICE INNER JOIN CUSTOMER ON invoice.CustomerID = customer.customerid

this selects all customers even if they have no invoices
SELECT InvoiceID, InvoiceDate, CustomerName FROM
INVOICE RIGHT JOIN CUSTOMER ON invoice.CustomerID = customer.customerid



jiri

Last edited by playernovis; 02-06-03 at 11:09.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On