View Single Post
  #72  
Old 11-03-2011, 10:10 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by cbk1994 View Post
Uhm, you should not be storing the community name in the table at all unless you're using it in addition to the account. I hope you're keeping in mind that some players don't have community names, and that they can change. The account should be used as an internal identifier. There are already functions available for getting a community name from an account (DB_Names.getCommunityName or something like that iirc) that you should be using.
could use a JOIN operation to get community names in a single query. Assuming the table that stores updated accounts/community names is called 'accounts':

NPC Code:
SELECT bulletin_table.account[, other_rows_you_need], accounts.communityname FROM bulletin_table
LEFT JOIN accounts ON bulletin_table.account = accounts.account;



My SQLite is a bit rusty, but I'm pretty sure the syntax is correct and that it would work without explicitly defining any primary/foreign keys.
__________________
Reply With Quote