Help with Union Query - Field type problem (1 Viewer)

yippie_ky_yay

Registered User.
Local time
Today, 07:15
Joined
Jul 30, 2002
Messages
338
Hello,

I've created a union query - the first query has a date field that the other does not (it's supposed to be blank). So, in the one that is supposed to have a blank for that field, I wrote: "Null AS myDate". Both queries work fine on their own, in the union query however, the entire column shows up as blank!

I suspect that the reason is that I have not included anything to let SQL know that myDate is to be a date field (???), so I tested by creating my field like this instead: "#1/1/1900# AS myDate"
This works, but I would rather know how to do this properly!

Thanks in advance!

-Sean
 

krunalprajapati

Registered User.
Local time
Today, 16:45
Joined
Dec 15, 2004
Messages
101
"Null as mydate" is worked. may be u didn't entered a value.

give the full query. so one can understand ur problem well.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:15
Joined
Feb 19, 2002
Messages
43,368
Reorder the select clauses within the union so that the one that has the date field is first. That way Jet will know what data type the column is when it gets to the select with the Null value.
 

yippie_ky_yay

Registered User.
Local time
Today, 07:15
Joined
Jul 30, 2002
Messages
338
Pat Hartman said:
Reorder the select clauses within the union so that the one that has the date field is first. That way Jet will know what data type the column is when it gets to the select with the Null value.
Ha - that works! Thank you Pat!

I'm curious though, is there not a way to let Jet know through SQL what field types you would like?

-Sean
 

Users who are viewing this thread

Top Bottom