Hi,

Im having a hard time figuring this maybe a simple query. This is my first time to use sql compact edition.
How can I query a select statement inside a select statement which tables are not related at all.

What i need to accomplish is to insert a logo inside a crystal report, and that logo is save as byte if im not mistaken into sql server database

I tried somthing like this but not working

Select Name, Add, (Select Logo From Company) as Logo From Client

Please somebody guide me the right query
Im using sql server 2008 r2 and visual studio 2010

Thanks

Recommended Answers

All 5 Replies

tables are not related at all

If there is no relation at all, how do you know which logo you need?

actually there's only one logo. I have a table where I edit company information including its logo. This logo need to show in Crystal report. Whatever Name, add the system extracts from database. only one logo is used.

how can I query it using sql ce?
thanks again

Try this:

SELECT Name, Add, Logo FROM Client, Company

Your a savior, my query runs in sql server, just need some modification for sql ce. Thanks pritaeas.

Assuming the Client table has companyid column, then you can use the below SQL Query to get the Logo value

  SELECT NAME, ADD, 
            (SELECT TOP 1 LOGO 
             FROM COMPANY 
             WHERE COMPANYID = CLIENT.COMPANYID) AS LOGO 
  FROM CLIENT

Hope this will solve your problem

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.