Source language: Translate to:

Query in a Query

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Query in a Query

Postby Alex » Fri Jan 22, 2010 2:02 am

Hello,

It is possible to make a query in a actual query with dbp?
I mean for example if I search the word "car" then it will show me all results with the word car, but then if I want to search the word boy in the result of car, it doesn't work, it shows me a new result with a sentense where the word boy is. It is possible to search the word boy in car's results?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby beno » Fri Jan 22, 2010 5:15 am

Hi,

A first approach would be to search for 'car' AND 'boy' in a single query.

My Mexican peso.

beno
User avatar
beno
 
Posts: 678
Joined: Fri Apr 01, 2005 9:03 am
Location: México

Postby Alex » Fri Jan 22, 2010 5:35 am

Hi,

Thanks Beno.

It is possible to search without AND? I want to search directly into the currently query.

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby smartmedia » Fri Jan 22, 2010 5:58 am

Hi..

Using SQL you can use an query inside one other one. It's a little bit complex but you can do it. I dont know if it's going to work using Access database.

Example1:
Code: Select all
select top 1 OrderId,convert(char(10),
       OrderDate,121) Last_Paris_Order,
      (select convert(char(10),max(OrderDate),121) from   
             Northwind.dbo.Orders) Last_OrderDate,
       datediff(dd,OrderDate,
      (select Max(OrderDate)from Northwind.dbo.Orders)) Day_Diff
from Northwind.dbo.Orders
where ShipCity = 'Paris'
order by OrderDate desc 


Example2:
Code: Select all
select Country,CompanyName, ContactName, ContactTitle, Phone
from Northwind.dbo.Customers
where country =
   (select top 1 country
         from Northwind.dbo.Customers C
                      join
              Northwind.dbo.Orders O
              on C.CustomerId = O.CustomerID
    group by country
    order by count(*))


thanks
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Alex » Fri Jan 22, 2010 8:29 am

Hi,

I use SQLite and I don't understand your example.

Why do you want that I oder my DB?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron