SQL Distinct / Distinctrow

S

Steven Scaife

I am unsure of what i need to do. I thought i needed to do a distinct, but
now i'm not sure.

I need to get these values from the database but need them grouping into
one, so that the total of all the books out

Book.Book_Title, OutGoing.Date_Out_To, sum(OutGoing.Quantity ),
Book.In_Stock

Access made me this query

SELECT DISTINCT Book.Book_Title, Book.In_Stock, Sum(OutGoing.Quantity) AS
Quantity
FROM Book INNER JOIN OutGoing ON Book.Book_Title = OutGoing.Manual_Name
GROUP BY Book.Book_Title, Book.In_Stock, OutGoing.Date_Out_To, OutGoing.Out
HAVING (((Book.Book_Title)=[forms]![subfrmCalendar]![Booked_Out_To]) AND
((OutGoing.Date_Out_To)>Date()) AND ((OutGoing.Out)=True));

But it doesnt group them into one row. I need them grouping and the total
of all the quantity fields, so i can make a calculation elsewhere in the
database.

if i just have SELECT DISTINCT Book.Book_Title then it groups any occurances
of the book title into one field.

Any ideas as to what i can do to get the information that i need. The
book_title and quantity are the most important values that i need.

TIA for any help and suggestions

Steven Scaife
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top