Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Informix Topics / December 2004

Tip: Looking for answers? Try searching our database.

SQL Query question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Hoefman - 28 Dec 2004 10:14 GMT
Hello,

I have a question regarding combining queries. We have this CMS
(Smartsite) for our website which has a meeting and a calendar module.
The module works with the following values;
nr, StartDate, EndDate, title
The nr-value is the unique pagenumber of the linked page. StartDate
and EndDate are obvious. Title is the name of the linked page which is
shown in the calendar as well.
The content is drawn out of a view called vwactive.
Parent is the pagenumber of which the current page is a child in the
hierarchy.

I had two calendars... one was filled with the meetings which came
from a meeting module an one was filled with other activities. The
department which has te work with those calendars asked me id I could
combiine the two calendars into one. Underneath you'll find the
seperate scripts I used to fill the calendars.

Could anyone give me a hint on how I should combine those two into
one?

MEETINGCALENDAR+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT a.nr, bisMeetingDate as StartDate, bisMeetingDate as EndDate,
title, bisLocations.Name as Location, bisMeetingStart, showUntil,
showFrom,
(SELECT DISTINCT dbms_lob.substr(body,12,1) as link FROM vwActive c
WHERE c.parent=a.nr and hyperlink=1 and contenttype=9) as
BestuursorgaanNr,
(SELECT Title FROM vwActive b WHERE Nr=(SELECT DISTINCT
dbms_lob.substr(body,12,1) as link FROM vwActive c WHERE c.parent=a.nr
AND hyperlink=1 and contenttype=9)) as Bestuursorgaan
FROM vwActive a, bisLocations
WHERE bisLocations.Nr=bisLocation AND
Parent=[Vergadering] AND
ContentType=9

ACIVITITIES CALENDER (This is the regular usage)++++++++++++++++++++

SELECT nr, StartDate, EndDate, title, showUntil, showFrom from
vwActive
WHERE Parent=6582

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Thanks in advance!
Marco
m.hoefman@lelystad.nl
Ben Thompson - 28 Dec 2004 10:50 GMT
Marco Hoefman asked:

> Could anyone give me a hint on how I should combine those two into
> one?

Simply by writing the word 'UNION' in between them? It will work
provided that the data types match in the two statements; if they do not
you will have to use a 'CAST'.

Ben.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.