Floydian Posted April 22, 2008 Share Posted April 22, 2008 Hey folks, I got a lil problem that is stumping me. There are two tables. One is for lawyers that players own. The other is for lawyer types. For brevity, I'll list the needed tables, and column names. Table: my_lawyersid --- auto incrementing primary key userid --- who the lawyer belongs to lawyer_id --- what kind of lawyer this is [*]lawyer_types id --- auto incrementing primary key salery --- what is this lawyers weekly salery? What I need is to find out how much each player will owe in lawyer salaries for the week. There is no quantity field in the my_lawyers table. Players could have 4 of the first type of lawyer, 3 of the second, and 2 of the third type. suppose the first type lawyer is paid 100 per week, the second 200, and the third 300, the query should do this lawyer type 1: 4 * 100 + lawyer type 2: 3 * 200 + lawyer type 3: 2 * 300 which would total 1600 The result of the query should provide one row, for every player that owns a lawyer. And this row should represent the total salery of all of that player's lawyers, and it should return that player's userid as well. If anyone can hit that up for me, that'd be great. I've come up with a few different queries, but all of them proved to return the wrong information. Thanks in advance to anyone that tries to figure this out :D Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.