sql help
am 07.01.2005 07:50:07 von Auddog
I need to know how to write this query. I been trying, but no luck. The
table layout is below:
Projects (Table 1)
id (primary key)
fk_projectid (number)
submittal (number)
I get new submittals all the time and what I want to do is query the
database for the last submittal number for a particular projectid. It's
quite simple, but I don't know how to get it.
A
Re: sql help
am 07.01.2005 08:45:59 von Donald Grover
SELECT TOP 1 submittal ORDER BY id DESC
"Auddog" wrote in message
news:uUQ9iUI9EHA.3368@TK2MSFTNGP10.phx.gbl...
>I need to know how to write this query. I been trying, but no luck. The
>table layout is below:
>
> Projects (Table 1)
>
> id (primary key)
> fk_projectid (number)
> submittal (number)
>
> I get new submittals all the time and what I want to do is query the
> database for the last submittal number for a particular projectid. It's
> quite simple, but I don't know how to get it.
>
> A
>
Re: sql help
am 07.01.2005 10:05:00 von thomasroji
SELECT Max(submittal)
FROM Projects fk_projectid = @yourId
WHERE
--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Auddog" wrote in message
news:uUQ9iUI9EHA.3368@TK2MSFTNGP10.phx.gbl...
>I need to know how to write this query. I been trying, but no luck. The
>table layout is below:
>
> Projects (Table 1)
>
> id (primary key)
> fk_projectid (number)
> submittal (number)
>
> I get new submittals all the time and what I want to do is query the
> database for the last submittal number for a particular projectid. It's
> quite simple, but I don't know how to get it.
>
> A
>
Re: sql help
am 07.01.2005 13:43:27 von reb01501
Roji. P. Thomas wrote:
> SELECT Max(submittal)
> FROM Projects fk_projectid = @yourId
> WHERE
>
>
Almost. it should be:
SELECT Max(submittal)
FROM Projects
WHERE fk_projectid = @yourId
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: sql help
am 07.01.2005 13:56:53 von thomasroji
Thanks Bob. That was a typical Friday problem
--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Bob Barrows [MVP]" wrote in message
news:umNr7ZL9EHA.2196@TK2MSFTNGP11.phx.gbl...
> Roji. P. Thomas wrote:
>> SELECT Max(submittal)
>> FROM Projects fk_projectid = @yourId
>> WHERE
>>
>>
> Almost. it should be:
>
> SELECT Max(submittal)
> FROM Projects
> WHERE fk_projectid = @yourId
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
Re: sql help
am 07.01.2005 14:30:12 von Auddog
Thank you everyone for your help - I knew it was easy, but in the early
morning I start to go blank.
A
"Roji. P. Thomas" wrote in message
news:OKEF5hL9EHA.1564@TK2MSFTNGP09.phx.gbl...
> Thanks Bob. That was a typical Friday problem
>
> --
> Roji. P. Thomas
> Net Asset Management
> https://www.netassetmanagement.com
>
>
> "Bob Barrows [MVP]" wrote in message
> news:umNr7ZL9EHA.2196@TK2MSFTNGP11.phx.gbl...
>> Roji. P. Thomas wrote:
>>> SELECT Max(submittal)
>>> FROM Projects fk_projectid = @yourId
>>> WHERE
>>>
>>>
>> Almost. it should be:
>>
>> SELECT Max(submittal)
>> FROM Projects
>> WHERE fk_projectid = @yourId
>>
>> Bob Barrows
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so I
>> don't check it very often. If you must reply off-line, then remove the
>> "NO SPAM"
>>
>
>