Question: I am completely new to programming in ASP.NET and do not understand why the error "Compiler Error Message: CS0103: The name 'Test1' does not exist in the current context" occurs on this basic piece of code.

Below is the code that I am trying to compile - 

```
<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
<title>Untitled Page</title>

</head>

<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Test1"/></asp>

<script runat="server">
 protected void Page_Load(object sender, EventArgs e)
{
Test1.Text = "Hello World; the time is now" + DateTime.Now.ToString();
}
</script>

</div>
</form>

</body>
</html>

```

Any assistance on why I'm receiving this error message would be greatly appreciated.

Answer: 
If you UNION this 2 selects and then make another select over it, you can make case\_id distinct if you put each other columns in MAX or MIN or SUM or COUNT or AVG ...

If you want first row to be distinct, second row must be in aggregate function.
Be careful! Yes, you can do things like wrap the two queries in a nested `SELECT` with a `GROUP BY` on the outer query... but it will absolutely kill your performance, because the DB will need to save the whole of the output of the inner queries to a temp table and requery them. If you've got even a moderate number of records being queried, it's just not going to be pretty.

You'd be much better off trying to combine the two queries into a single query in the first place.

When you're looking at queries like this it can get complex to do it, but it can be done, and the performance ought to be significantly better.

I don't have time to come up with the perfect query for you right now, but there have been a few other questions here and elsewhere about how to do this sort of thing. Maybe one of these will help you?

* [Combining two GROUP BY queries grouped by the same column](https://stackoverflow.com/questions/6727697/combining-two-group-by-queries-grouped-by-the-same-column)
* [Combine two small queries (that group by different values) into one query](https://stackoverflow.com/questions/1806365/combine-two-small-queries-that-group-by-different-values-into-one-query)
* <http://forums.devshed.com/mysql-help-4/combining-results-of-two-group-by-queries-806682.html>