Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two grid with the same data

Status
Not open for further replies.

ivatanakoo

IS-IT--Management
Oct 9, 2014
23
PH
i have two tables with the same data but:
i this is i want
2nd table
item​
quantity
product​
3

1st table
item​
quantity
product​
1
product​
1
product​
1

i want that the quantity of a product in the 1st table is sum up to the 2nd table..

should i use locate and add the qty of the same product?..
 
It could be as simple as this

Code:
Select Sum(quantity), product from table1 group by product into cursor table2

It seems a rather odd requirement, though.
 
it gives me the error..
alias name is already in use
 
alias name is already in use

That's because the alias name is already in use.

I don't mean to sound facetious. My point is that this is not an error in the code that Dan suggested. Rather, there is something wrong with your choice of table aliases. Typically, this happens because you have opened a table with a given alias, and you are now trying to open another table with the same alias. Note that creating a cursor with a SELECT statement has the same effect as opening a table in this context.

So the solution might be as simple as choosing something other than Table2 as the name of the output cursor from the SELECT statement.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top