I have the `internalid` of an address. This query ...
# general
e
I have the
internalid
of an address. This query gets the correct address name, internalid and nothing more.
SELECT * FROM addressbook WHERE internalid = 12602053
What other table must I join to get the address detail? (label, city, zip, etc) Using ODBC I join
ADDRESS_BOOK
and
ADDRESSES
. In SuiteQL address or addresses doesn't seem to exist.
b
go to the records catalog to find the more useful entity and transaction addressbook related tables
j
So at least for me, the actual
address
table is not listed in the sidebar menu
but it does exist!
if you manipulate the URL to end in /record_ss/Address you will find the definition
b
be extra careful that you know the difference between the id of the addressbook and the id of the address, they are different things
j
yep
and they aren’t really truly JOINed I don’t think
what record are you trying to get addresses associated with, @Edgar Valdes?
that will determine the name of the table for the addressbook
e
Custom fields in an Inventory Transfer.
j
OK well I don’t deal with those but it’s a similar method no matter what
Here’s an example to get addresses for a customer
Copy code
SELECT customer.id, customer.entityid,
customeraddressbook.internalid AS addressbook_id,
customeraddressbookentityaddress.addrText

FROM customer
JOIN customeraddressbook ON customeraddressbook.entity = customer.id
JOIN customeraddressbookentityaddress ON customeraddressbook.addressbookaddress = customeraddressbookentityaddress.nkey

WHERE customer.id = 265
🙌 1
start in records catalog from the base record (in my example it’s customer)
then click here to follow the rabbit down the hold
the little i icon is extremely helpful for figuring out your joins
e
Thanks @jen Will put my SQL hat on
j
I could be wrong (@battk might know) but I don’t think addresses themselves have ids.
e
Done The ID I have correspond to
customeraddressbook.internalid
customeraddressbook
doesnt have the columns I need, those are on
customeraddressbookentityaddress
The join is between
customeraddressbook.addressbookaddress
AND
customeraddressbookentityaddress.nkey
And the filter is
customeraddressbook.internalid
= my internal ID
Thanks!