Question: Im using ASPxPopUpControll in which I have ASPxCallBack panel. THis CallbackPanel was embeded there because I wanted to have solution based on callbacks despite of reloading page each time.

In this CallBackPanel I've embeded asp:Wizard control. 

What I want to achive is get rid of postbacks after clicking next previous etc buttons in this wizzard.

Any hints?

Maybe there is other way to create nice wizard without any postbacks ?

thanks for help

Answer: 
I think you need a subquery joining the event table with an aggregation of itself returning only the min(event dates)

```
SELECT
contact.id,min_created,cash.id2    -- the cash linked to the first event
,eve.id      -- the first event linked to the contact    
FROM _contact contact 
INNER JOIN _table2 tb2  ON contact.id = tb2.id1
INNER JOIN _event eve  ON tb2.id2 = eve.id
inner join (select id, date_created as min_created from _event group by id) eve_min
on eve_min.id = eve.id and eve_min.min_created = eve.date_created 
INNER JOIN _cashtable cash  ON cash.contact_id = contact.id

```
You shouldn't need to add them into the group-by clause, but you do need to aggregate them somehow. The point of the group-by clause is that you want a grouping of statistics. That is, you want everything for that same contact id, not just the first record.

I believe if you do something like

```
SELECT Contact.Id,
  MIN(eve.date_created),
  MAX(eve.date_created), //this will get you the range of events
  SUM(cash.id2), //total cash for all events
  MIN(eve.Id), //First event id
  MAX(eve.Id) //Latest event id
FROM _contact Contact //Etc. etc.

```

your query will work for grouping. What it seems like you want, however, is more like:

```
[Select your columns]
FROM _contact Contact 
INNER JOIN _Table2 tb2 on contact.id = tb2.id1 
  and tb2.id1 = (Select MIN(id2) from tb2 where tb2.id1 = contact.id)
INNER JOIN _event eve on tb2.Id2 = eve.id
INNER JOIN _cashtable cahs on cash.contact_id = contact.id
  and cash.id = (select MIN(id) from cash where cash.contact_id = contact.id)

```

YMMV, and I your table structure will partially dictate how fast that runs (that is, you may want to look at some optimizations). Also, I did that completely from memory, so you may need to play with those `INNER JOIN`s to get them to work. The point here is that you're not trying to grab the group, your trying to grab the first one for each `contact.id`.