|
-
May 29th, 2001, 04:02 AM
#1
VB / SQL help
Hi all, I hope you can help me out. I am doing a bit of 'community service' for a struggling farm near here...I have created a database for him to record the cattle he has, (type, age, date bought etc etc) and we needs some reports from the system and I dont know the easiest way to do it...
1. user inputs a date. system outputs all cattle and the age on that date and other row data.
please provide any psudo code and any ideas you may have! thanks a lot !!
-
May 29th, 2001, 07:25 AM
#2
Re: VB / SQL help
This could be an example SQL statement. Note that you should make the date (here hardcoded 01/01/2001) variable by using parameterized queries. This assumes you are using Access
SELECT *, IIF(DateBorn > #01/01/2001#,'Not born yet', DateDiff("d",DateBorn,'01/01/2001') & ' days') AS Age
FROM Cows
WHERE DateDead > #01/01/2001#
This gives you all the data of all cows who weren't dead on 01/01/2001, plus the age in days. If a cows wasn't born yet, you will also see that.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|