Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get data from 2 tables
Message
 
 
À
08/02/2019 08:42:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008 R2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01666006
Message ID:
01666105
Vues:
50
Can you please start from the beginning and explain the problem you're trying to solve? Show some samples of the data as well.

Why you're joining based on the hour? If that's the requirement, may be you need to store hour directly in addition to the date? Or have a computed column?

https://docs.microsoft.com/en-us/sql/relational-databases/indexes/indexes-on-computed-columns?view=sql-server-2017

Thanks

>>I didn't really read the original problem, so I don't know if proposed solution is good or not. I just commented that it's better to use T-SQL to create views and not SSMS designer which can not work with complex views.
>
>Yes thanks for helping
>
>I describe issue here in short.
>
>I am using these codes provided by Sir Christian Isberner
>
>
>CREATE VIEW Test
>AS SELECT Date, DatePart(hour,Date) as Hr, reading
>FROM TABLE1 A
>WHERE Date IN 
>(SELECT Min(Date) as date
>FROM TABLE1 B
>WHERE DatePart(hour,A.Date) = DatePart(hour,B.Date) 
>UNION
>SELECT Min(Date) as date
>FROM TABLE2 C
>WHERE DatePart(hour,A.Date) = DatePart(hour,C.Date))
>
>
>I want to create view, the codes takes long time to display data.
>My question is: is it possible to modify above codes with JOIN clause?
>If yes then I guess the view will not take long time to display data.
>
>Regards
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform