hi, completely new here . . . finding training res...
# suiteql
s
hi, completely new here . . . finding training resources already, but a question just from querying stuff in datagrip. when i query the transactions table there is a field 
billingaddress
 . . . using the schema/record/connect/analytics browser pages i can't quite correlate how/where it relates . . . in MS SQL there would be a FK and you could see it pointing to address or billingaddress table . . . in this case those tables do not exist (there are customeraddressbook etc) . . . if i use the BUILTIN-DF i can get related data but i can't figure out where it's cominng from and how the docs would tell me that so, how do i figure out where billingaddress "points"? thanks much
t
@smoke raven I think you want to use that to join to the EntityAddress table. Here's an example:
Copy code
SELECT
	Transaction.TranID,
	BillToAddress.Addressee AS BillToAddressee,
	BillToAddress.Addr1 As BillToAddress1,
	BillToAddress.Addr2 As BillToAddress2,
	BillToAddress.Addr3 As BillToAddress3,
	BillToAddress.City As BillToCity,
	BillToAddress.State As BillToState,
	BillToAddress.Zip As BillToZip,
	BillToAddress.Country As BillToCountry,
	BillToAddress.Attention As BillToAttention
FROM
	Transaction
	INNER JOIN EntityAddress AS BillToAddress ON
		( BillToAddress.nkey = Transaction.BillingAddress )
WHERE
	( Transaction.ID = 52284082 )
s
awesome @tdietrich. . . your blog was first resource i found that made sense to me . . . but yeah still trying to find the five-15 minute "hey, here's how netsuite setup their database structure" and so forth but this query helps enormously
t
Glad it helped. If you ever find something that shows "here's how netsuite setup their database structure" let us know!
s
i guess
nkey
is the foreign key for addresses and
id
for most everything else?
t
Yeah. So much for consistency, right?
s
i think i'm suffering from "not knowing oracle db" intersecting with netsuite . . . using the jdbc openaccess sql driver i'm finding all kinds of basic stuff like
desc <table>
and
fetch next 10 rows only
not working . . . is that Netsuite and/or the driver you think?
@tdietrich nevermind . . . i had someone explain pretty well . . ."to internalize this, think about the odbc driver as a sort of api around the actual tables" 🙂
t
Glad you got an answer - and sorry for the delay. When using the ODBC method, the tables names, columns, etc are likely going to be quite different from those available via SuiteQL.
👍 1