Hi. I am stumped when trying to figure out how to make it so the name in one column is just listed once with nulls values underneath until the next column name. I'm sorry if I don't explain this right.

I have this script:

SELECT NAME, SELLPRICE "Price Sold", COSTPRICE "Product Cost", ROUND( (SUM(SELLPRICE)  - SUM(COSTPRICE))*100 / SUM(SELLPRICE)) as "% Profit"
FROM GS_SALES , GS_CUSTOMER
where GS_CUSTOMER.CUSTID = GS_SALES.CUSTID
GROUP BY CITYID,NAME, SELLPRICE, COSTPRICE
ORDER BY CITYID;

which seems to give me the right results except that I want null values under the name field in the name colmn after a name is listed once and until it gets to the next unique name. Also if my script above looks off, please let me know.
Thank you. :)

Recommended Answers

All 5 Replies

Are you trying to create a report out of this query ?

yes, without the duplicate names

The reporting tool will handle the 2nd part of your question.

I don't know what you are saying. So this can't be done in SQL statements?

You need not do that using SQL.

That is a standard feature in any reporting tool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.