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 |
|
ramone_johnny
Starting Member
35 Posts |
Posted - 2009-06-24 : 02:13:28
|
| Hey guys,Im trying to pull information from a DB, and I am unsure as to how best to write this query. Im not the best when it comes to SQL.Heres the details ...database - sql server 2000table name - tblnew_citiescolumn namespcode_postcode - intpcode_area - nvarcharpcode_state - nvarcharpcode_ID - UIDpcode_stateID - intpcode_city - nvarcharpcode_cityID - intpcode_areaID - intIn english heres what I need.I need each distinct pcode_areaID, and pcode_area, as well as the pcode_postcode.So as an example...Yamanto as a suburb would be pcode_postcode - 4305pcode_area - Yamantopcode_areaID - 15317Now the problem I am faced with is that many suburbs share the SAME postcode, so using distinct as i know it, doesnt work.An example of this would beYamanto and Raceviewpcode_postcode - 4305pcode_area - Yamantopcode_areaID - 15317pcode_postcode - 4305pcode_area - Raceviewpcode_areaID - 11388Would someone be able to help me write this query?Thanks,JohnComplete newbie. Please forgive me for having to ask such stupid questions... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-24 : 02:56:51
|
What is the expected output from this sample data?Yamanto and Raceviewpcode_postcode - 4305pcode_area - Yamantopcode_areaID - 15317pcode_postcode - 4305pcode_area - Raceviewpcode_areaID - 11388 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
ramone_johnny
Starting Member
35 Posts |
Posted - 2009-06-24 : 03:10:44
|
| Errr...I guess I would need them to be grouped by postcode?pcode_area - Yamantopcode_areaID - 15317pcode_area - Raceviewpcode_areaID - 11388pcode_postcode - 4305Complete newbie. Please forgive me for having to ask such stupid questions... |
 |
|
|
ramone_johnny
Starting Member
35 Posts |
Posted - 2009-06-24 : 03:58:27
|
| Anyone have any suggestions ???Complete newbie. Please forgive me for having to ask such stupid questions... |
 |
|
|
ramone_johnny
Starting Member
35 Posts |
Posted - 2009-06-24 : 08:18:28
|
| Could someone please offer some assistance with this sql query?Complete newbie. Please forgive me for having to ask such stupid questions... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|