Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | ashwikaStarting Member
 
 
                                        9 Posts | 
                                            
                                            |  Posted - 2011-03-16 : 19:28:51 
 |  
                                            | I have a file with Request details and another table with Booking Details Request table Key – requested                           managerID           dateRequested           noPcsReq           noPcsBooked             loanFrom           requestDateBooking Table    Key :       bookingID                  requestID                        managerID                dateRequested                dateLoanFrom                dateReturned                 noPcsBookedManager tableKey     managerID        name         telephone       a user is allowed to query  the database to find all records relating to a)	Manager  or b)	Manager and fromRequestDate and ToRequestDateAnd output results containing: No.of pcs ordered ,noPcsBooked   date requested    Loanfrom date    Manager    etc etc So 3 parameters @managerID and @fromDate and @toDate will be inputto this query .How do I query the tables in SQL – please advise |  |  
                                    | ms65gConstraint Violating Yak Guru
 
 
                                    497 Posts | 
                                        
                                          |  Posted - 2011-04-08 : 13:56:04 
 |  
                                          | Your request is dynamic searching.Try something like this: SELECT any_columns_you_need  FROM Request  Natural Join Booking  Natural Join ManagerWHERE (manager_name = @manager_name OR @manager_name IS NULL)  AND (fromRequestDate = @param OR @param IS NULL)  AND ...______________________ |  
                                          |  |  |  
                                    | LampreyMaster Smack Fu Yak Hacker
 
 
                                    4614 Posts |  |  
                                |  |  |  |