problem with query
Posted: Fri Aug 04, 2006 4:14 am
Hi,
First of all i want to sorry of my english. Now i will explain what problem do i have.
I have 2 tables, in first table i write book code and this book copy codes, like this:
books table:
data looks laike this
In second table goes info about book orders:
orders table:
in staus field can be 3 posibilities like: rent ordered and in_store
my problem is: i whant to count how many users wants one book and count how many copys i have (hope you understand me
) how should i write a query/querys to have theys numbers?
First of all i want to sorry of my english. Now i will explain what problem do i have.
I have 2 tables, in first table i write book code and this book copy codes, like this:
books table:
Code: Select all
book_id
book_copy_id
other info...Code: Select all
book_id | book_copy_id
1 | 100
1 | 101
1 | 102
2 | 103
2 | 104
etc..orders table:
Code: Select all
order_id
user_id
book_id
stausmy problem is: i whant to count how many users wants one book and count how many copys i have (hope you understand me