|
No. Just try it. And read up on normalization.
|
|
|
|
|
Hi,
Please let me know the solution of mentioned Oracle Query, that how can I use the same in MySQL.
SELECT A.CNAME, B.ANAME FROM CLIENT A, DEALER B
WHERE A.CCODE=B.ACODE(+)
Thanks
(Riaz)
|
|
|
|
|
Which part did not work? What error did it throw?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
MySql doesn't do implicit outer joins, you'll have to do the full ANSI syntax instead.
SELECT. A.CNAME, B.ANAME
FROM CLIENT A,
LEFT OUTER JOIN DEALER B
ON A.CCODE = B.ACODE
Wrong is evil and must be defeated. - Jeff Ello
(√-sh*t) 2
|
|
|
|
|
..that's what the plus does?
Nice
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, but note that the plus isn't on the outer side. It marks the side with the nulls.
Wrong is evil and must be defeated. - Jeff Ello
(√-sh*t) 2
|
|
|
|
|
|
|
COURSE (CourseID, Cname, Ccredit)
TEACHER (TeacherID, Tname, Toffice)
STUDENT (StudentID, Sname, Sclass)
TAKE_COURSES (CourseID, TeacherID, StudentID, Score, ClassRoom)
Question:
List all the name of students whose subjects are all past.
The answer is:
SELECT Sname
FROM STUDENT
WHERE NOT EXISTS(
SELECT *
FROM TAKE_COURSE
WHERE TAKE_COURSE.StudentID= STUDENT.StudentID AND Score<60)
I can't understand this sentence
WHERE TAKE_COURSE.StudentID= STUDENT.StudentID AND Score<60)
Can anyone please tell me how to resolve it?
Thank you very much.
|
|
|
|
|
The statement selects all the records from table TAKE_COURSE, but filters them by the WHERE clause. Saying WHERE NOT EXISTS at the start, filters out those records where the StudentIDs match but the student score is less than 60. So you should end up with all students who have a score of 60 or greater.
|
|
|
|
|
Yes.
I understand it.
Thank you very much.
|
|
|
|
|
Dear sir i have installed sqlserver 2008 r2 sp2 & vs.net 2010 I make a project in ado.net to add data in sql database with no error. the program runs well but when i go to the add button it says that "Login failed for this user" plzzzzzzzzzz help.....
|
|
|
|
|
Not enough information!
Use SQL credentials - user id and password registered in SQL server, do NOT use integrated security.
Create the user for your app in SQL server eg userid - MyAppUser
Give the user dbo rights to your database
Use those credentials in your connection string.
If this does not make sense to you then get a book or an article and work through the examples.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
What help do you need? The error tells you exactly what the problem is.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Case 1:
Suppose there are two computers (Ser1, Ser2) and SQL Server 2005 Express is installed on each machine, the input will be stored on the machine Ser1, if the data changes on the computer Ser1 will be updated again computer Ser2, the ask my SQL Server 2005 express can update data on the computer Ser2 from Ser1 ? How the computer config ?
Case 2:
Suppose there are two computers (Ser1, Ser2) and SQL Server 2005 Express is installed on each machine, the input will be saved to Ser1 or Ser2, meaning that if the computer Ser1 busy, it will save computer Ser2 or else, and 2 machine Ser this is always synchronized data.
if I understand this issue I find the document what ? or what keywords to search on google.com?
|
|
|
|
|
Here you go some Google Foo[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I do not get through formal classroom training school, not knowing I ask you help, if you are not only helping out loud, do not know without question, the more bites.
|
|
|
|
|
And english is not your first language, I understand that. However the results of the search I supplied will give you more information and better resources than a forum post. Your requirement is not trivial small.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
SQL Server 2005 Express cann't create Replication\Local subcriptions ? because sql warning: Microsoft SQL Server Management Studio is unable to access replication components because replication is not installed on this instance of SQL Server. For information about installing replication, see the topic Installing Replication in SQL Server Books Online.
|
|
|
|
|
I would not expect replication to be available in an Express version as it is one of the advanced features of the database but I don't know as I use neither the Express nor do I need the replication features.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I configure SQL Server Merge Replication, when merger database together, if one of the two server machines damaged or die, the software did not transfer it, i have to manually reset ip to the software to run, how to automatically switch to 1 in 2 server fails ?
|
|
|
|
|
How can I change the below code snippet from using cursor to using table expression. The below code is about getting specific data for general account and all accounts below such given account
FUNCTION [dbo].[GetChildrenAccount]
(@AccountID INT,
@DateFrom DATETIME,
@DateTo DATETIME,
--@TypeTransaction INT,
--@Currnecy INT,
@Branch INT)
RETURNS DECIMAL(18,3)
AS
BEGIN
DECLARE @Account_ID AS BIGINT,
@IsLeaf AS BIT,
@TotalValue AS DECIMAL(18,3),
SELECT @TotalValue = ISNULL(SUM(JournalDet_Debit),0) * CASE WHEN @Currnecy = 0 THEN AccountBranch_CurrencyConv ELSE 1 END
FROM AccountTree
INNER JOIN Account_InBranch ON (AccountBranch_AccountID = Account_ID)
LEFT JOIN Journal_Details ON (Account_ID = JournalDet_AccountID)
LEFT JOIN Journal_Head ON (Journal_ID = JournalDet_HeadID)
WHERE (Account_ParentID = @AccountID OR Account_ID = @AccountID )
AND Journal_BranchID = @Branch
AND Journal_Date >= @DateFrom AND Journal_Date <= @DateTo
GROUP BY AccountBranch_BegBalDebit , AccountBranch_BalanceDebit , AccountBranch_CurrencyConv
OPEN GetAccount_ID
FETCH NEXT FROM GetAccount_ID INTO @Account_ID
WHILE @@fetch_Status = 0
BEGIN
SET @TotalValue = @TotalValue + dbo.GetChildrenAccount(@Account_ID,@DateFrom,@DateTo,@Branch)
FETCH NEXT FROM GetAccount_ID INTO @Account_ID
END
CLOSE GetAccount_ID
DEALLOCATE GetAccount_ID
RETURN ISNULL(@TotalValue,0)
END
|
|
|
|
|
You seem to be missing the definition of your GetAccount_ID cursor.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I removed some parts of the function when posting may be I forgot and remove the declaration for
GetAccount_ID and here is the declaration
DECLARE GetAccount_ID CURSOR STATIC FOR
SELECT Account_ID FROM AccountTree WHERE Account_ParentID = @AccountID AND Account_Isleaf = 0
|
|
|
|
|
It's tricky to answer without your table definitions and some sample data, but this should get you close:
WITH cteAccountTree As
(
SELECT
@AccountID As Account_ID
UNION ALL
SELECT
P.Account_ID
FROM
cteAccountTree As P
INNER JOIN AccountTree As C
ON C.Account_ParentID = P.Account_ID
And
Account_Isleaf = 0
)
SELECT
@TotalValue = IsNull(Sum(JournalDet_Debit), 0) * CASE WHEN @Currency = 0 THEN AccountBranch_CurrencyConv ELSE 1 END
FROM
cteAccountTree As T
INNER JOIN Account_InBranch As B ON B.AccountBranch_AccountID = T.Account_ID
LEFT JOIN Journal_Details As JD ON JD.JournalDet_AccountID = T.Account_ID
LEFT JOIN Journal_Head As JH ON JH.Journal_ID = JD.JournalDet_HeadID
WHERE
Journal_BranchID = @Branch
And
Journal_Date Between @DateFrom And @DateTo
;
The first part is a recursive common table expression (CTE):
How to use recursive CTE calls in T-SQL[^]
This should return the list of all accounts in the tree which have the specified account ID as an ancestor, excluding any with the Account_Isleaf flag set.
NB: If your tree is particularly deep, you might run into the default recursion limit. There will probably be a way to work around it, but it won't be as nice as the recursive CTE solution.
You then join the tree of account IDs to your branch and journal tables to calculate the total in one hit.
The only part I'm not sure about: your code seems to be double-counting at each level:
<hr size="1" color="#63B4FF" noshade="">
<span style="color: rgba(0, 88, 170, 1)">
<cite>"These people looked deep within my soul and assigned me a number based on the order in which I joined."</cite>
- Homer
</span>
|
|
|
|