Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query for Rates
Message
De
18/08/2016 06:01:44
 
 
À
18/08/2016 05:54:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01639610
Message ID:
01639612
Vues:
104
This message has been marked as the solution to the initial question of the thread.
Is this what you are looking for:
SELECT Products.Code
		,Products.products
		,rates.rate
FROM Products LEFT JOIN rates ON products.code = rates.code AND rates.date = DATE(2016,8,16)
>Sir, I have these codes
>
>
>CREATE CURSOR products (code c(4),products c(10))
>INSERT INTO products values('1401','Apple')
>INSERT INTO products values('1402','Mango')
>INSERT INTO products values('1403','Banana')
>INSERT INTO products values('1404','Dates')
>INSERT INTO products values('1405','Peach')
>
>CREATE CURSOR rates (date d(8),code c(4),products c(10),rate n(3))
>INSERT INTO rates values({^2016/08/16},'1401','Apple',80)
>INSERT INTO rates values({^2016/08/16},'1402','Mango',90)
>INSERT INTO rates values({^2016/08/17},'1401','AppLE',100)
>INSERT INTO rates values({^2016/08/17},'1405','Peach',110)
>
>
>I want to create a report which will display rates from Rates.dbf again any given dates
>
>Suppose I enter 16-08-16 then it must display all Products from Master.dbf and rates from Rates.dbf like this
>
>code Products Rate
>1401 Apple 80
>1402 Mango 90
>1403 Banana
>1404 Dates
>1405 Peach
>
>I need sql solution only because I shall use the query in php+mysql.
>
>I triedthis query but it displays only those products those are in rates table. But I want to display all products from Master.dbf+rates shown in image.
>
>
>SELECT Rates.date,products.code, products.products,  Rates.rate;
>  FROM  products ;
>   left JOIN rates ;
>   ON  products.code = Rates.code;
> WHERE  Rates.date = ( {^2016/08/16} )
>
>
>Attachment is snapshot of tables.
>
>Thanks
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform