|
Hello ! I'm doing little project and I need database for it, but not whole server. So I choose Access ... But that's pain in the a**
I have a relatively simply query in which I need to do LEFT JOIN:
SELECT a.*, b.*
FROM a LEFT JOIN b ON (a.pid = b.pretplatnik_id) AND (a.iid = b.izdanje_id);
a and b are booth some other queries. I needed to do this because I can't do query inside a query in access And there's problem. It all works, except it shows only data from query a and nothing from query b. Everything from b is NULL. Interesting thing is that if I change part "LEFT JOIN" to "INNER JOIN" it returns booth results from query a and b. So does anyone have an idea why LEFT JOIN isn't working ?
Thanks for your time and help
|
|
|
|
|
try to use
LEFT OUTER JOIN
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Thanks for help But it's not working Same result as just using "LEFT JOIN"
|
|
|
|
|
Well,if you don't mind then post here some tables data, and result which you want to get and we will try to give you hand on query.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Thanks, but I've solved it
In b query I've had GROUP BY statement, and it was something like SELECT blabla FROM bla GROUP BY pid, iid;
Now I've changed it to SELECT blabla FROM bla GROUP BY iid, pid; and everything works ... Although I don't think there's any difference, but ok ... if there is, please explain it to me
|
|
|
|
|
It's possible to use DISTINCT instead of GROUP BY but when you had solution then let it as it is.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Yes, but can I use distinct with two fields ? And I also did use SUM with GROUP, I think that I can't use sum with distinct ...
|
|
|
|
|
When you have case to use agregate functions then better use GROUP BY but still you can use DISTINC and with subquery you can get SUM or any else agregate function.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Ok, thanks. It's good to know
|
|
|
|
|
In my Application I use the stored procedure sp_helpsubscriberinfo. On a Microsoft SQL Server 2000 this works as it should. But on a SQL Server 2008 it returns me an empty table. This happens also through the SQL Server Management Studio, so it is no error in my Application.
Has anything chaged in accessing/using this stored procedure?
[Update]
The return code of sp_helpsubscriberinfo is 0, means no error.
The stored procedure sp_helpmergesubscription returns a non-empty table with the same user account.
[/Update]
Thanks for your help!
Roland
|
|
|
|
|
Hi to all,
IIf(IsDBNull(reader.Item("Amount")), 0, Convert.ToDouble(reader("Amount")))
Can anyone tell me what is the problem in this line if any? Please its urgent.
Waiting for your earliest response.
cheers,
sneha
|
|
|
|
|
Problem.... hmmm... do you get any error? What makes you think there's a problem? Only thing I can see is that you're not assigning the result to any variable... could that be it?
|
|
|
|
|
A description of the problem you're getting would help. Also the VB forum would be more appropriate.
What SQL type is Amount? I'm not that well up in VB but in C# you'd get a compiler error due to the difference in type of the last two parameters in your iif.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: you'd get a compiler error due to the difference in type of the last two parameters in your iif
I thought of that, but something tells me VB will be alot more foregiving. It will no doubt choose the right datatype depending on the phase of the moon raised to the power of the current millisecond, but only on tuesdays.
|
|
|
|
|
It also works of Thursday providing that it is the last Thursday in the month or the first if the number of days in the month is equal to that of the previous month... it's a lot more complex than you initially thought I'm afraid
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi frd's
Our client needs that his data base should be encrypted. Here i want to encrypt data base in such manner that it should work normally from .net web application but when some one tries to open it in SQL server IDE it should not show raw data. Even password protection is also OK for me for .MDF and .LDF files.
Help me please...
Thanks & Regards,
Anil Chelasani
|
|
|
|
|
Here is some help[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i have to display leave allotted record of a single employee in gridview but because i have stored three records of permanent employee in generalinfo table its displaying three times my query is as follows
SELECT LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID
what should i do to rectify this problem
a help from somebody will be deeply appreciated.
|
|
|
|
|
Have you tried the distinct keyword ?
SELECT distinct LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID
_____________________________
Those who study history are doomed to watch others repeat it. -Scott M.
|
|
|
|
|
Thank you smcnulty
i forgot to do that now its working
once again thankyou very much
|
|
|
|
|
Yes I fully agree with Scott M
Use distinct clause
Niladri Biswas
|
|
|
|
|
Team,
I have a web Windows server 2003 64-bit and installed Sql server analysis services 2000 along with SP4, the problem is that: our application is ASP classic and has the connection string:
"Provider=MSOLAP.2;Timeout=60;Data Source=localhost;Initial Catalog=myCube;Client Cache Size=25"
I can not find a provider for MSOLAP.2, I have copied most of the dlls from the legacy server (32-bit) and registered them, but still cannot connect to that cube.
when I check with a .udl file I don't see any provider for OLAP.
What do I need to setup? Any idea? What is wrong here?
Note: I can open analysis services manager and connect to my cubes successfully.
please advice.
Thanks in advance.
ThaScorpion
|
|
|
|
|
how to handle no data found error in sql server
|
|
|
|
|
How is it an error? It just means youur query returned no results. Handle it where? Please explain exactly what the problem is, my mystic powers are worn out by Friday.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Suppose i have a table like this..
COL1 COL2 COL3
X 100 1
X 200 2
X 300 3
Y 100 1
Y 200 2
Z 300 1
i want to select col1 where 100=1 and 200=2 and 300=3
My small attempt...
|
|
|
|