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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-10-25 : 18:33:01
|
James writes "Hi Guru,
I have a query I built which does almost everything I need. I discovered yesterday that I need to select MAX effdt from the ps_address table.
Can you help me with this one?
Thanks,
SQL = "" SQL = SQL & "SELECT cust.cust_id as customer_id, cust.name3, cust.nameshort, cust.cr_analyst as credit_analyst_id," SQL = SQL & "cust.collector as collector_id, cust.corporate_cust_id, cust.sales_person as Sales_id," SQL = SQL & "cust.billing_specialist as bill_specialist_id, cust.crspd_cust_id as corres_cust_id, " SQL = SQL & "cust.customer_type as customer_type_id, cust.name1, seq.address_seq_num as location_number, " SQL = SQL & "seq.bill_to_addr as bill_to_address, seq.ship_to_addr as ship_to_address, " SQL = SQL & "seq.sold_to_addr sold_to_address, add.phone, seq.descr as description, seq.crspd_to_addr as corres_address, " SQL = SQL & "add.effdt as eff_date, add.fax, add.city as town1, add.county as town2, add.postal as zip_code,add.country, " SQL = SQL & "add.extension as ext, add.address1, add.address2, add.address3, add.state " SQL = SQL & "FROM ps_customer as cust, ps_cust_addr_seq as seq, ps_cust_address as add " SQL = SQL & "WHERE cust.cust_id = seq.cust_id and seq.cust_id = add.cust_id and " SQL = SQL & "cust.setid = seq.setid and seq.setid = add.setid and " SQL = SQL & "seq.address_seq_num = '" & location_number & "' and " SQL = SQL & "cust.cust_id = seq.cust_id and " SQL = SQL & "cust.cust_id = '" & customer_id & "'"
James " |
|
|
|
|
|
|
|