Querying dates between two tables

  • Thread starter Thread starter Freeman girl
  • Start date Start date
F

Freeman girl

I have a query that has multiple columns with dates. I need to be able to
query one column against another column. Is that possile?

Example: Column A has an admission date to a hospitalization
Column B has an authorization date.

I need for my query to only pull hospitalizations (column A) that occurred
after authorizations were issued (column B)

Is it possible to tell one column to look at and query against another column?
 
It is very easy if you are talking about the same record --
SELECT [Column A], [Column B]
FROM YourTable
WHERE [Column A] > [Column B];
 
On Thu, 4 Mar 2010 15:19:01 -0800, Freeman girl <Freeman
I have a query that has multiple columns with dates. I need to be able to
query one column against another column. Is that possile?

Example: Column A has an admission date to a hospitalization
Column B has an authorization date.

I need for my query to only pull hospitalizations (column A) that occurred
after authorizations were issued (column B)

Is it possible to tell one column to look at and query against another column?

Yes; you can use a criterion on column A such as
[Column B]

The brackets are essential and should contain the actual fieldname of the
other field. Note that relational database tables are NOT spreadsheets; the
proper jargon term is "field", not "column".

You might want to open your query in SQL view and post the SQL text here so
people can see more clearly what you're dealing with.

Also note that your subject line refers to "between two tables" and your text
"between two columns"; both are doable but the technique will be different.
 
Thank you for your help, this did the trick!

KARL DEWEY said:
It is very easy if you are talking about the same record --
SELECT [Column A], [Column B]
FROM YourTable
WHERE [Column A] > [Column B];

--
Build a little, test a little.


Freeman girl said:
I have a query that has multiple columns with dates. I need to be able to
query one column against another column. Is that possile?

Example: Column A has an admission date to a hospitalization
Column B has an authorization date.

I need for my query to only pull hospitalizations (column A) that occurred
after authorizations were issued (column B)

Is it possible to tell one column to look at and query against another column?
 
Thank you for the clarifications. This helped tremendously!
John W. Vinson said:
On Thu, 4 Mar 2010 15:19:01 -0800, Freeman girl <Freeman
I have a query that has multiple columns with dates. I need to be able to
query one column against another column. Is that possile?

Example: Column A has an admission date to a hospitalization
Column B has an authorization date.

I need for my query to only pull hospitalizations (column A) that occurred
after authorizations were issued (column B)

Is it possible to tell one column to look at and query against another column?

Yes; you can use a criterion on column A such as
[Column B]

The brackets are essential and should contain the actual fieldname of the
other field. Note that relational database tables are NOT spreadsheets; the
proper jargon term is "field", not "column".

You might want to open your query in SQL view and post the SQL text here so
people can see more clearly what you're dealing with.

Also note that your subject line refers to "between two tables" and your text
"between two columns"; both are doable but the technique will be different.
 
Back
Top