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 |
|
CoachBarker
Posting Yak Master
170 Posts |
Posted - 2009-02-04 : 17:28:52
|
| Say I have a tableTableCustomerand I have created another table in a Query, so I have TableCustomer1 now I need to merge a couple of fields from at least one of the tables and they are cutomer_bill_to and customer_deliver_to have the same customer_number, so what I need is actually the customer, something like :SELECT cutomer_bill_to AND customer_deliver_to AS customer_combined. Is this possible and have I made it clear what I want?Thanks for the helpCoachBarker |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-04 : 17:35:53
|
| Please Show us sample data and expected output. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-04 : 17:52:22
|
| Can't you just concatenate both the fields? Like Sodeep said, if you can give sample data and what you expect, it'll be good. |
 |
|
|
CoachBarker
Posting Yak Master
170 Posts |
Posted - 2009-02-04 : 20:04:17
|
| OK I will make it simpler I hope. I have one table, TableCustomer.customer _number1,2,3,4,5,6customer_namecustomer_addressthe next table is TableCustomerPayments.payment_numberpayment_typecustomer_deliver_to(customer_number1,4,6,customer_bill_to(customer_number)1,2,5,6I need to get customer_number 1,2,4,5,6Now in a report for Payments I need information that is based on the Customer. This is based on the customer_number. It doesn't matter if it is for deilver or bill, just the numbers. I also need to check between two dates. Am I better off writing a query where the WHERE part is;WHERE customer_deliver_to = @customer_number AND customer_bill_to @customer_number AND pickup_date BETWEEN @start_date AND @end_date or would it be WHERE customer_deliver_to = @customer_number OR customer_bill_to @customer_number AND pickup_date BETWEEN @start_date AND @end_date or is there a way to doWHERE customer_deliver_to AND @customer_number AS @customer_number AND pickup_date BETWEEN @start_date AND @end_date Make any sense?Thanks for the helpCoachBarker |
 |
|
|
|
|
|
|
|