dbTalk Databases Forums  

subquery syntax

comp.database.ms-access comp.database.ms-access


Discuss subquery syntax in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ilaboo
 
Posts: n/a

Default subquery syntax - 10-31-2004 , 09:08 AM






i have a table

name, desc, podate

with name/desc character and podate a date field


it is a table of vender names line descriptions and purchase order dates

i need to find the last time a order was placed

this is my query

select name,desc from mytable group by name,desc where (select
max(podate) from mystuff)

i keep getting syntax errors

can you help
tia
peter

Reply With Quote
  #2  
Old   
Ken Snell
 
Posts: n/a

Default Re: subquery syntax - 10-31-2004 , 12:44 PM






Try this:

SELECT [name], [desc], (SELECT Max(mystuff.podate)
FROM mystuff WHERE mystuff.[name] =
mytable.[name]) FROM mytable
GROUP BY [name], [desc];


--

Ken Snell
<MS ACCESS MVP>


"ilaboo" <plener (AT) earthlink (DOT) net> wrote

Quote:
i have a table

name, desc, podate

with name/desc character and podate a date field


it is a table of vender names line descriptions and purchase order dates

i need to find the last time a order was placed

this is my query

select name,desc from mytable group by name,desc where (select
max(podate) from mystuff)

i keep getting syntax errors

can you help
tia
peter



Reply With Quote
  #3  
Old   
ilaboo
 
Posts: n/a

Default Re: subquery syntax - 10-31-2004 , 01:45 PM



Ken Snell wrote:
Quote:
Try this:

SELECT [name], [desc], (SELECT Max(mystuff.podate)
FROM mystuff WHERE mystuff.[name] =
mytable.[name]) FROM mytable
GROUP BY [name], [desc];


ken

i am dealing with only i table called mystuff

tia
peter


Reply With Quote
  #4  
Old   
Ken Snell
 
Posts: n/a

Default Re: subquery syntax - 11-01-2004 , 12:10 PM



podate is in table mystuff? Then it's easy:


SELECT [name], [desc], Max(podate)
FROM mystuff
GROUP BY [name], [desc];
--

Ken Snell
<MS ACCESS MVP>

"ilaboo" <plener (AT) earthlink (DOT) net> wrote

Quote:
Ken Snell wrote:
Try this:

SELECT [name], [desc], (SELECT Max(mystuff.podate)
FROM mystuff WHERE mystuff.[name] =
mytable.[name]) FROM mytable
GROUP BY [name], [desc];


ken

i am dealing with only i table called mystuff

tia
peter



Reply With Quote
  #5  
Old   
ilaboo
 
Posts: n/a

Default Re: subquery syntax - 11-02-2004 , 07:28 PM



Ken Snell wrote:
Quote:
podate is in table mystuff? Then it's easy:


SELECT [name], [desc], Max(podate)
FROM mystuff
GROUP BY [name], [desc];
ken
thank
you
i think i was leaving the ; out

thanks
peter


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.