473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Advanced Sql-Shape Query - Help

Hi,

This is my basic sql shape query:
------------------------------------------------------------
SHAPE {select * from tbl1}
APPEND({SELECT * FROM tbl2 where field1=1} AS RS2 RELATE field TO
field)
------------------------------------------------------------

With this query i get a RecordSet (RS1), who handle all the records
from table tbl1, and a secondary RecordSet (RS2) who handle all the
records from table tbl2, who applies to the criteria that field1=1.

It is possible that RS2 will be empty (zero records) since there is no
record in tbl2 who applies to that criteria.

My wish is to design a query, that will collect only the records from
tbl1, that will have records from tbl2 who applies to the criteria -
that RS2 won't be empty !

I want to influence on the main part of the query (RS1), through the
criteria that is being used in the secondery query (RS2).

I hope that my question is clear enough. thanks !

Jan 12 '06 #1
3 7116
(do*****@gmail.com) writes:
This is my basic sql shape query:
------------------------------------------------------------
SHAPE {select * from tbl1}
APPEND({SELECT * FROM tbl2 where field1=1} AS RS2 RELATE field TO
field)
------------------------------------------------------------

With this query i get a RecordSet (RS1), who handle all the records
from table tbl1, and a secondary RecordSet (RS2) who handle all the
records from table tbl2, who applies to the criteria that field1=1.

It is possible that RS2 will be empty (zero records) since there is no
record in tbl2 who applies to that criteria.

My wish is to design a query, that will collect only the records from
tbl1, that will have records from tbl2 who applies to the criteria -
that RS2 won't be empty !

I want to influence on the main part of the query (RS1), through the
criteria that is being used in the secondery query (RS2).

I hope that my question is clear enough. thanks !


If I get this right you want this in the SHAPE part:

SELECT * FROM tbl1
WHERE EXISTS (SELECT * FROM tbl2 WHERE tbl2.field = tbl1.fiedl)

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 12 '06 #2
I didn't know i can use the exists query - I will check it out and get
back to report.

thanks for your help !

Jan 13 '06 #3
Well, It works like a charm !!!!

thank you !!!

Jan 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Chris Mosser | last post by:
Until recently, I thought MySQL, and SQL in general was no problem....doing simple INSERTS, DELETES, and UPDATES;...then I heard about triggers, transactions, and stored procedures which I only...
1
by: Barb | last post by:
What is the limitation of memory that SQL Server 2000 Standard can use when running on a Windows 2000 Advanced Server platform?
3
by: ChrisL | last post by:
I currently have two SQL server books for MS SQL Server 2000. One is a prep book for the 70-229 exam, the other is a Wrox book: "professional SQL Server 2000 Programming." I'm looking for more...
2
by: Asteras | last post by:
Hi there, If we have a student score table with the names of 5 students and their marks in two exams: +--------+-------+-------+ | Name | Mark1 | Mark2 | +--------+-------+-------+ | John...
10
by: John Wells | last post by:
Are there any books out there that are fairly current, but go into the more advanced aspects of Postgresql, such as internals and advanced programming? I'd rather avoid the whole intro to SQL with...
1
by: javawzl | last post by:
I am looking for a 3rd party advanced (SQL) search control that I can basically plug and play into my ASP.Net and supplement with additional fields (like a country drop down). That is, I don't...
2
by: Jon Paal | last post by:
-- Testing Visual Web Developer and sql server 2005 express to create and populate a datagrid In the sql server configuration wizard for a datagrid, I am trying to get the update code to be...
3
by: | last post by:
I'm planning to transport a desktop application to the web. A spin-off of this application has already been put on the web by another programmer. He used ColdFusion with MS SQL, Access, VC, and...
4
by: alcstudio | last post by:
Have this SQL-string: SQL = "select id as pid from projekt union select count(*) as totalt from kostnader where id = pid and status = 1" And i get this error: * No value given for one or more...
0
by: priyamv | last post by:
Hi, Can anyone suggest me good links for learning advanced sql and inbuilt features os sql server 2005 .
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.