I do lack the experience of SQL programming so it may be an easy question for the xperts to answer
I have a query that is returning a list and I want to use the group by clause. However I cannot get it to work. I get error messages saying that it is incorrectly formatted or does not recognise the command.
here is the query...
SELECT z68_order_date,
substr(z68_order_number,1,15),
substr(z13_author,1,20),
substr(z13_title,1,35),
z13_isbn_issn
FROM z68, z13
WHERE substr(z68_rec_key,1,9) = z13_rec_key
AND z68_order_status = 'SV'
AND z68_order_type = 'M'
AND z68_order_date <= '20030408'
group by z68_sub_library;
Now, for using the group by statment do I have to include the field in the select clause?
I dont think the group by would work on this query so I would like some advice on how to do so.
Basically I wan the results listed by z68_sub_library (there are only three different types).
How would I change this query to do so?
I should say that there are two tables and I'm matching by rec_key, which is the primary key for both tables.
I have a query that is returning a list and I want to use the group by clause. However I cannot get it to work. I get error messages saying that it is incorrectly formatted or does not recognise the command.
here is the query...
SELECT z68_order_date,
substr(z68_order_number,1,15),
substr(z13_author,1,20),
substr(z13_title,1,35),
z13_isbn_issn
FROM z68, z13
WHERE substr(z68_rec_key,1,9) = z13_rec_key
AND z68_order_status = 'SV'
AND z68_order_type = 'M'
AND z68_order_date <= '20030408'
group by z68_sub_library;
Now, for using the group by statment do I have to include the field in the select clause?
I dont think the group by would work on this query so I would like some advice on how to do so.
Basically I wan the results listed by z68_sub_library (there are only three different types).
How would I change this query to do so?
I should say that there are two tables and I'm matching by rec_key, which is the primary key for both tables.