Chris Lahti
|
| Posted: 04/15/2003, 12:09 PM |
|
Hello all:
I have a drop list being populated by a MySql table as a "lookup". The lookup table is as follows:
Table forecasts
forecast_id int(11) primary_key auto_inc
forecast_date date()
initial_period int(11)
I also have the table for periods, foreign key for initial_period
Table period_defs
period_id int(11) primary_key auto_inc
month_text varchar(50)
So to make a long-winded post short, I have a grid of the forecast table, and in the search droplist I would like to have display field in the drop list as a concatenation of two fields, the SQL would look SOMETHING like this (but this does not work!):
SELECT forecast.forecast_id, forecast.forecast_date + ' - ' + period_defs.month_text AS display WHERE forecast.initial_period = period_defs.period_id order by 2
if the above SQL worked, the bound column for the listbox would have the forecast_id, and the display would look like (for example):
04/15/2002 - April
Any ideas?
/Chris
|
|
|
 |
RonB
|
| Posted: 04/15/2003, 1:23 PM |
|
SELECT forecast.forecast_id, concat_ws('-',forecast.forecast_date, period_defs.month_text) AS display WHERE forecast.initial_period = period_defs.period_id order by 2
MySQL has excelent documentation at their site(WWW.MYSQL.COM)
RonB
|
|
|
 |
|