princess21
New Member
- Joined
- Jun 10, 2011
- Messages
- 15
Wonder if anyone could help. I am using an internet based system which has access data tables behind it storing information. My collegue and I are not very IT so sorry if this does not make sense.
We have a data table with a list of routes which are linked to weekdays, we then have a seperate data table which is a list of 'Unique Street Reference Numbers' and 'Unique Property Reference Numbers' we currently have the below sql query to bring all this information togther and to select the correct day of collection, however this is not bringing back any results.
select ct.collection_type, DATENAME(weekday,cd.date) as weekday, convert(varchar(11),cd.date,113) as date, case when c.active=0 then 'SKIPPED' else '' end as msg from collection_date cd inner join collection c on cd.collection_id=c.id and cd.active=1 inner join route_property rp on c.route_id=rp.route_id and ((rp.USRN={usrn}) or (rp.UPRN={Customer_Details/uprn})) inner join collection_type ct on c.collection_type_id=ct.id where cd.date>=GETDATE() and {collection_types}+',' like '%'+ct.collection_type+',%' group by c.id, cd.date, ct.collection_type, c.active order by cd.date
Does anyone have any suggestions.
Hugs
Princess
We have a data table with a list of routes which are linked to weekdays, we then have a seperate data table which is a list of 'Unique Street Reference Numbers' and 'Unique Property Reference Numbers' we currently have the below sql query to bring all this information togther and to select the correct day of collection, however this is not bringing back any results.
select ct.collection_type, DATENAME(weekday,cd.date) as weekday, convert(varchar(11),cd.date,113) as date, case when c.active=0 then 'SKIPPED' else '' end as msg from collection_date cd inner join collection c on cd.collection_id=c.id and cd.active=1 inner join route_property rp on c.route_id=rp.route_id and ((rp.USRN={usrn}) or (rp.UPRN={Customer_Details/uprn})) inner join collection_type ct on c.collection_type_id=ct.id where cd.date>=GETDATE() and {collection_types}+',' like '%'+ct.collection_type+',%' group by c.id, cd.date, ct.collection_type, c.active order by cd.date
Does anyone have any suggestions.
Hugs
Princess