Old Appointments! (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


box -> Old Appointments! (6/8/2009 0:16:55)

Hi there,

My table contains the following fields:

Ptnumber
Firstname
Lastname
Nexappt

The past and future appointments are stored in “nextapt” which is a Date/Time field. I want to know who does not have a future appointment so we can follow up later. Here is what I did but is not working.

fp_sQry="SELECT * FROM appt WHERE (nextapt < #::todaydate::#) ORDER BY lastname ASC"

I wanted to sort whoever’s appointment is less than current day “todaydate” also I need to display only one time, name because one person has many old appointments! But again didn’t work! Do you have any idea? Maybe a new approach? thanks




swoosh -> RE: Old Appointments! (6/8/2009 9:09:01)

Just to make sure. Do you have a typo just in your post or in your code. You mentioned your field name was "Nexappt" but referenced " nextapt" in your code.

As for displaying non duplicate names you could use the "distinct" keyword:

SELECT DISTINCT "column_name"
FROM "table_name"




box -> RE: Old Appointments! (6/8/2009 10:27:03)

no is not problem with typo, thanks. any idea please.




TexasWebDevelopers -> RE: Old Appointments! (6/8/2009 12:08:21)

What is the format/definition of nextapt and todaydate?
Is nextapt a timestamp in an Access database?
Is todaydate defined as <%=Now()%> ?
What error are you getting?




Spooky -> RE: Old Appointments! (6/8/2009 16:20:20)

As for displaying non duplicate names you could use the "distinct" keyword: 


I think that was the idea :-)




box -> RE: Old Appointments! (6/8/2009 16:20:48)

nextapt and todaydate are Date/Time fields and todaydate is <%response.write(fixTheDate(Date()))%> is the function to send the current date!




box -> RE: Old Appointments! (6/9/2009 10:22:55)

I guess there is no solution for my problem![:(]




TexasWebDevelopers -> RE: Old Appointments! (6/9/2009 11:34:15)

Still not quite enough information. What error are you getting?
Your function "fixthedate" doesn't tell us anything.
Is the format a short date? long date? general date?
I am just trying to confirm, first, that the formatting for nextapt and todaydate are the same.




box -> RE: Old Appointments! (6/14/2009 15:16:18)

fp_sQry="SELECT DISTINCT FROM appt1 WHERE (ptnumber = '::ptnumber::' ) "

Database Results Error
Description: The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine



what syntax should i use to display the most recent record?

Thanks




TexasWebDevelopers -> RE: Old Appointments! (6/14/2009 20:45:47)

The format should be sql="SELECT DISTINCT [field] FROM [table] WHERE .....

http://www.texaswebdevelopers.com//examples/sql_intro.asp




box -> RE: Old Appointments! (6/15/2009 0:44:04)

I dont think this format will work with Database Results Wizard (DRW)!




TexasWebDevelopers -> RE: Old Appointments! (6/15/2009 8:05:03)

sure it will




box -> RE: Old Appointments! (6/15/2009 10:05:48)

if I use this
SELECT DISTINCT * FROM

it displays duplicated records!

but if I use this:

SELECT DISTINCT [field] FROM

I get the following:

Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
/ep/_fpclass/fpdblib.inc, line 48







TexasWebDevelopers -> RE: Old Appointments! (6/15/2009 10:56:57)

Box---[field] is just a placeholder for the distinct record you are trying to query---I don't have a clue what that column name is dude!

You are making this too hard on yourself...say the sentence in English and you will get there. "I want to get a distinct record named (your field/column name) from my table named (your table name)...etc."




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625