A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Anyway to join between two different data types?



 
 
Thread Tools Display Modes
  #1  
Old February 23rd, 2010, 04:18 PM posted to microsoft.public.access.queries
foghat
external usenet poster
 
Posts: 2
Default Anyway to join between two different data types?

Hi all,

I have a Access database that is linking to Oracle tables.

I need to join on two different data types. Number and Varchar2.

With a oracle query, it is easy: one can simply put a to_char on the number
data type. So:

select *
from invoice i, comment c
where to_char(i.invc_id) = c.reference_id

However, I can't see any way to do this with the Access query (in either
Design View or SQL View).

Is this possible?

  #2  
Old February 23rd, 2010, 05:07 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Anyway to join between two different data types?

This will be slow, but have you tried using one of the conversion functions

select *
from invoice i, comment c
where (i.invc_id) & "" = c.reference_id


In a join that could be.
SELECT *
FROM Invoice as I INNER JOIN Comment as C
ON I.Invc_ID & "" = C.Reference_ID

If you were sure that Invc_ID always has a value (never null)
SELECT *
FROM Invoice as I INNER JOIN Comment as C
ON CStr(I.Invc_ID) = C.Reference_ID

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

foghat wrote:
Hi all,

I have a Access database that is linking to Oracle tables.

I need to join on two different data types. Number and Varchar2.

With a oracle query, it is easy: one can simply put a to_char on the number
data type. So:

select *
from invoice i, comment c
where to_char(i.invc_id) = c.reference_id

However, I can't see any way to do this with the Access query (in either
Design View or SQL View).

Is this possible?

  #3  
Old February 23rd, 2010, 05:19 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Anyway to join between two different data types?

select *
from invoice i, comment c
where CStr(i.invc_id) = c.reference_id ;
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"foghat" wrote:

Hi all,

I have a Access database that is linking to Oracle tables.

I need to join on two different data types. Number and Varchar2.

With a oracle query, it is easy: one can simply put a to_char on the number
data type. So:

select *
from invoice i, comment c
where to_char(i.invc_id) = c.reference_id

However, I can't see any way to do this with the Access query (in either
Design View or SQL View).

Is this possible?

.

  #4  
Old February 23rd, 2010, 05:35 PM posted to microsoft.public.access.queries
foghat
external usenet poster
 
Posts: 2
Default Anyway to join between two different data types?

Jerry Whittle wrote:
select *
from invoice i, comment c
where CStr(i.invc_id) = c.reference_id ;
Hi all,

[quoted text clipped - 15 lines]

.


Thanks a lot. Works like a charm. I just don't use Access enough, but
figured there must be a to_char equivalent.

  #5  
Old February 23rd, 2010, 06:27 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Anyway to join between two different data types?

Where Oracle uses to_ Access often uses C for Change

CDate = todate

Of course to_char for character isn't quite CStr for change string!

And don't get me started on Oracle vs Access wild cards and usage of single
and double quotation marks!
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"foghat" wrote:

Jerry Whittle wrote:
select *
from invoice i, comment c
where CStr(i.invc_id) = c.reference_id ;
Hi all,

[quoted text clipped - 15 lines]

.


Thanks a lot. Works like a charm. I just don't use Access enough, but
figured there must be a to_char equivalent.

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.