General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>I want to make a small temporary table with two columns, one to show unique names that appear in a larger table, and the other for how many times each name occurs.
>>
>>USE majors
>>DIMENSION listt(20)
>>SELECT DISTINCT advisor FROM majors WHERE !EMPTY(advisor) INTO ARRAY listt
>>CREATE TABLE tempadv FREE (name C(20), number N(2))
>>APPEND FORM listt FIELDS name
>>
>>Up to this point it works. The first column has one of each name from the larger table.But how exactly do I use COUNT to get the number of times each name occurs in the larger table? I have trouble with the FOR clause. I've even tried macro substitution (which I know is a bad idea) but I can't get the statement to pass the name from the table and use it to filter records in the other.
>
>Peter,
>
>Try this:
>select count(*),advisor from majors group by advisor into cursor mycursor
Just small changes:
select advisor,count(*) from majors where !empty(advisor) group by 1 into array listt
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only