Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Possible Use of a Cursor

 
   Database Help (Home) -> Visual Basic RSS
Related Topics:
sql query returns in wrong format - Hi, Hope someone can help me with this. I have MS SQL 2000 database where i have Table and there a column wich is data type All data in this column is in form So why when i run .asp page with simple query to..

arrays - is there a way to the contents of an array (looping through the array) and storing each item in a comma delimited string? Thanks!

DataReport PageBreak - Hi everyone, I would like to know how to force pagebreak in a for example after 5 records printed. Thank you all

Scroll Bars - Is there a way to find the size of on a system using Visual Basic 6.0? I know how to look and change them on the display but I don't know how to access that from within Visual Basic.

Can I Update entire record in SQL ? - Heya, I am working on making a SQL database an exact mirror of a local Access database. I check the .mdb database every few minutes for new entries, if there are new entries, I retrieve them and write them to an exact replica table in SQL. This all works
Next:  Visual Basic: Can I Update entire record in SQL ?  
Author Message
user3444

External


Since: Jan 26, 2005
Posts: 32



(Msg. 1) Posted: Tue Feb 22, 2005 8:43 am
Post subject: Possible Use of a Cursor
Archived from groups: comp>lang>basic>visual>database (more info?)

I have a complex query that I hope I can explain it well enough for
everyone to understand.

I have a table that contains information for work instructions.
Contained in the table are "MACHINE_PROC" these are groupings of
machining processes (milling,drilling etc). Contained also in the table
are "INSTRUCTION" that are a grouping of machining processes in a
particular order. In order to organize the order "MACHINE_PROC" are
made they become a "POSITION_NR".

"INSTRUCTION" can have any number of "POSITION_NR" and
"MACHINE_PROC". "POSITION_NR" are always acending meaning that the
smallest number is at the begining of a instruction and the larger a
number towards the end.

The problem that I have is that I want to look for a given set of
machining processes (MACHINE_PROC) from groups 3500, 3400 and 3430 in
the first position of a given INSTRUCTION. The problem is that the
first step of a INSTRUCTION doesn't always have the same number.

Normally the first "POSITION_NR" of a job is "10" and the second "20"
and so on... Room is left between the steps in case that a extra step
needs to be added.

If a step needs to be added before the first step it will get a
number below "10" and if a step needs to be added between the first and
second step it will be between "10" and "20" and so on...

Hopefully you understand me in what I'm trying to explain. Here's 2
examples to help along.

Remember I'm looking for the first step in an "INSTRUCTION" that has
"MACHINE_PROC" 3600, 3400 or 3430

Example 1
INSTRUCTION_NR | MACHINE_PROC | POSITION_NR
123456 | 3600 | 10
123456 | 5600 | 20
123456 | 4587 | 30

Example 2
INSTRUCTION_NR | MACHINE_PROC | POSITION_NR
456789 | 3600 | 5
456789 | 6522 | 10
456789 | 7841 | 20

Does any one know how to go about this do I need to write a cursor of
can I do this by using a couple select statements.

P.S. This is not homework. This is a real problem that I have. I took
the time to write this post, please don't respond to it saying
it's homework or that I should read the manual

 >> Stay informed about: Possible Use of a Cursor 
Back to top
Login to vote
dhodgkins

External


Since: Feb 15, 2005
Posts: 3



(Msg. 2) Posted: Tue Feb 22, 2005 12:22 pm
Post subject: Re: Possible Use of a Cursor [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Look at your SQL code. I recreated a table (just called Table1) with
those three columns and ran a query with the following SQL code:

SELECT Table1.Instruction_NR, Table1.MACHINE_PROC,
First(Table1.POSITION_NR) AS FirstOfPOSITION_NR
FROM Table1
GROUP BY Table1.Instruction_NR, Table1.MACHINE_PROC
HAVING (((Table1.Instruction_NR)=123456) AND ((Table1.MACHINE_PROC) In
(3600,3400,3430)))

David Hodgkins
dhodgkins RemoveThis @jstarsoftware.com

 >> Stay informed about: Possible Use of a Cursor 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]