Re: SubQuery Help
Posted by:
Nick Roper
Date: August 15, 2004 03:12PM
Hi Steven,
OK, first all:
> I understand how to search for customers whose
> name starts with "A"
>
> SELECT * from contacts where
> concat(FirstName,LastName) like "%a%"
>
Um, this is going to find all contacts with an 'a' anywhere in the concatenation of their first and last name.
To find contacts whose LastName starts with 'A':
SELECT * from contacts where LastName like "A%";
> I understand how to count the days until the last
> visit:
>
> SELECT Min(To_Days(Current_Date()) -
> To_Days(calendarevents.EventDate)) FROM
> contacts,calendarevents WHERE
> calendarevents.CustomerLink=contacts.RecordID AND
> (To_Days(calendarevents.EventDate) <=
> (To_Days(CURRENT_DATE)))
>
> how to I get the above calcuation query into the
> resultset for my "names starting with 'A'" query?
>
> I thought I could do it with subqueries, but I
> haven't been able to figure it out yet.
>
This looks a bit complex. If you're using PHP there's probably an easier way. Can you post the structures of the tables with a few rows of example data and what the results should be?
> Thanks in advance for any help!
>
--
Nick Roper
Subject
Written By
Posted
Re: SubQuery Help
August 15, 2004 03:12PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.