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 |
|
Jon G
Starting Member
31 Posts |
Posted - 2008-11-17 : 07:57:02
|
| Hi,I have a problem that is driving me nuts. I am building a web application that needs to query a sequel 2000 database in the following way.I firstly need to search table "branches" for all records where fulladdress LIKE "london" (which will return approx 200 records).From each of the records returned from that query I need to return all records from table "suppliedmedia" where "branchid" is equal to the "ID" field of the "branches" table.The data that I then display within my application will be one database grid that shows the field "fulladdress" from table "branches" and then datesupplied field from table "suppliedmedia"To hopefully be clear:table branches looks like this:id,fulladdresstable suppliedmedia looks like this:id,branchid,datesuppliedMy database grid needs to show the data like this:fulladdress(from branches),datesupplied(from suppliedmedia)fulladdress(from branches),datesupplied(from suppliedmedia)fulladdress(from branches),datesupplied(from suppliedmedia)fulladdress(from branches),datesupplied(from suppliedmedia)fulladdress(from branches),datesupplied(from suppliedmedia)fulladdress(from branches),datesupplied(from suppliedmedia)etc.I hope this makes sense? This is driving me absolutely nuts.many thanks in advanceJon |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-17 : 08:01:41
|
[code]SELECT b.FullAddress, sm.DateSuppliedFROM Branches AS bINNER JOIN SuppliedMedia AS sm ON sm.BranchID = b.ID[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-11-17 : 08:05:07
|
additional:where b.FullAddress like '%london%'Webfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Jon G
Starting Member
31 Posts |
Posted - 2008-11-17 : 08:17:15
|
| Damn that was quick. Thank you very much. I can now get on with my application instead of starring at a blank screen for hours on end. I was trying to make this too complex not realising how nice an clean and small your code is.Brilliant.thanks againJon |
 |
|
|
|
|
|
|
|