Re: How can I merge two pairs of fields into 1 pair of fields
- From: "pietlinden@xxxxxxxxxxx" <pietlinden@xxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 20:47:54 -0700
On Oct 28, 5:13 am, efandango <efanda...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Piet,
I have managed to get my Columns just how I need them with this SQL:
SELECT Run_To AS Run_Title, Run_No, Run_To_Postcode AS Postcode,
Run_From_Postcode AS Unused FROM tbl_Runs WHERE Run_No <=320
ORDER BY Run_No
UNION ALL SELECT Run_From AS Run_Title, Run_No,Run_From_Postcode ,
Run_To_Postcode FROM tbl_Runs WHERE Run_No <=320
ORDER BY Run_No;
Which gives me:
Run No Run Title Postcode Unused
1 Easy St N4 N1
1 Main St N1 N4
2 South St N1 WC1
2 North St WC1 N1
to put the icing on the cake, it would be nice if I could dispense with the
'Unused' column from the results grid, I suppose the SQL needs to use the
'Run_From_Postcode' field to complete the process, but is there some kind of
'Don't Show' command with SQL which will use the field, but not show its
result. I know I can simply hide the column in the results, but it would be
cleaner (for later use) if it wasn't there in the first place.
Thanks for your help on this, much appreciated.
"pietlin...@xxxxxxxxxxx" wrote:
On Oct 27, 4:25 pm, efandango <efanda...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I have four fields which I want to merge into 2 fields:
Run_From
Run_To
Run_From_Postcode
Run_To_Postcode
I want to merge the above two sets of data from each pair into two new fields:
Run_Title
Run_Postcode
I tried doing it with a Union query, but I think that only works on 2
tables?. I have just the one table (which I can't split, as it is critical to
the rest of the database.)
this is my SQL for the query
SELECT tbl_Runs.Run_No, tbl_Runs.Run_From, tbl_Runs.Run_From_Postcode,
tbl_Runs.Run_To, tbl_Runs.Run_To_Postcode
FROM tbl_Runs;
Sure you can. You can union two datasets from the same table.
SELECT RunFrom AS Run_Title
WHERE ...
FROM tbl_Runs
UNION ALL
SELECT RunTo AS Run_Title
FROM tbl_Runs
WHERE ...
so I guess RunTitle would be the result if an IIF statement...
uncheck the show button... (under the field name in the QBE grid).
.
- References:
- Re: How can I merge two pairs of fields into 1 pair of fields
- From: pietlinden@xxxxxxxxxxx
- Re: How can I merge two pairs of fields into 1 pair of fields
- From: efandango
- Re: How can I merge two pairs of fields into 1 pair of fields
- Prev by Date: Re: make +ve number -ve and -ve number stay same in same column
- Next by Date: Query Last Balance in Given Entity in Linked ODBC Table
- Previous by thread: Re: How can I merge two pairs of fields into 1 pair of fields
- Next by thread: RE: query returns records that don't match criteria
- Index(es):
Relevant Pages
|