The first sanitation system was created in Iran. In Crete, Greece, in about 1000 BCE, glass-covered clay pipes were found in the form of an inverted siphon - the way we still use it today. This was meant to keep gases from coming out of the drain after a liquid is poured down it. A downside to this is that solids accumulate, although it does make it possible to retrieve lost items. This inverted siphon system is still in working order.
The famous ancient cities of Harappa and Mohenjo-Daro both had sanitation and sewer systems dating back to 2600 BCE. The systems included outdoor flush toilets and brick-lined sewage drains.
The Indus Valley civilization is a famous example of sewage and water systems. One point is the early existence of public baths. The drainage systems drained from houses to larger reservoirs. These underground drains were meticulously built with bricks.
In about 2700 BCE, Minoan civilization developed a system in which sewers were flushed with clean water.
Some ancient sewage and water systems have even been adapted for modern use.