|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Displaying one of many
Hi
I have two tables On called actions and one called repleys the idea being someone puts in a action(actions table) and others repley (repley table) and with this one action can have several repleys all good. However i'am stuck on a summary page what i'am trying to do is list all the actions in a table(this is easy) in col 1 in col 2 insert the latest repley to that action i've tried using the Join SQL statement but when i repeat region the table it lists all the repleys and not just the latest (see code below) SELECT inp_date, reid, action, rep_date, fromName FROM contacts, repley_tb WHERE reid = #URL.recordID# AND contacts.id = repley_tb.actionID ORDER BY actionID DESC Anyone got any ideas how i can display a action and its latest repley only |
|
#2
|
||||
|
||||
|
Code:
select inp_date, reid, action, rep_date, fromname
from contacts
inner
join repley_tb RRR
on contacts.id = repley_tb.actionID
where reid = #URL.recordID#
and rep_date =
( select max(rep_date)
from repley_tb
where actionID = RRR.actionID
)
order
by actionid desc
|
|
#3
|
|||
|
|||
|
Hi Just tried your code but i get the following error
you have a error in your sql syntax near ( select max(rep_date) from repley_tb where actionID = RRR.actionID) order by Any ideas what is causing this? Best Regards Krellee |
|
#4
|
||||
|
||||
|
just a guess
your version of microsoft sql server does not support subqueries ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Displaying one of many |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|