16,012,116 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 9848727 (Top 17 by date)
Member 9848727
12-Sep-13 12:45pm
View
SELECT
otd.userid,
otd.task,
otd.date_request,
ot.approved_by
FROM
otd
INNER JOIN
ot ON otd.userid = ot.requested_by
and otd.date_request = ot.date_request
WHERE
otd.userid ='xxx'
AND CONVERT(varchar,otd.date_request,101) BETWEEN '09/10/2013' AND '09/11/2013'
AND ot.status ='A'
ORDER BY otd.date_request,ot.date_request ASC
Member 9848727
6-Sep-13 6:50am
View
I have searched. I just want to achieve through query but not the function thats the reason why i posted .
Member 9848727
6-Sep-13 6:46am
View
Hey,
Thanku its working.
Is there any other way without using function?
Member 9848727
3-Sep-13 9:23am
View
I want a query not an SP or else function
Member 9848727
23-Jul-13 8:25am
View
It is not possible in msSql.. Once the table is created we cant alter the position of the columns in the table
Member 9848727
23-Jul-13 6:18am
View
ya thank you its working but the table name and column name must have to be enclosed within the inverted commas...
Member 9848727
23-Jul-13 5:53am
View
It is returning the error as invalid column name for both the column name and the table name
Member 9848727
22-Jul-13 3:20am
View
This is not working. I will clearly explain you.
I have two tables as following
tableA:
EMPid name company
TableB
EMPId Name qualification company
Now i want the output as follows
Qualification
It should return only one column(Qualification) because it is the only column which is different between 2 tables
Member 9848727
22-Jul-13 3:01am
View
Different columns between two tables not the data
Member 9848727
31-May-13 8:14am
View
I got the solution
DECLARE @Table TABLE(UnitTypeID INT,UnitType VARCHAR(MAX),Attribute1 VARCHAR(MAX),Attribute2 VARCHAR(MAX) ,Attribute3 VARCHAR(MAX),Attribute4 VARCHAR(MAX),
Attribute5 VARCHAR(MAX),Attribute6 VARCHAR(MAX) ,Attribute7 VARCHAR(MAX),Attribute8 VARCHAR(MAX))
INSERT INTO @Table
SELECT
UnitTypeID
,UnitType
,[1] AS Attribute1
,[2] AS Attribute2
,[3] AS Attribute3
,[4] AS Attribute4
,[5] AS Attribute5
,[6] AS Attribute6
,[7] AS Attribute7
,[8] AS Attribute8
FROM
( SELECT UM.UnitTypeId,ROW_NUMBER()OVER(PARTITION BY UnitType ORDER BY Displayas) as AttributeId,UnitType, DisplayAs
FROM
dbo.UnitTypeMaster UM
INNER JOIN
dbo.UnitType_Attributes UA ON UM.UnitTypeId = UA.UnitTypeId
WHERE ISNULL(um.ActiveYN,1) =1
) AS TempTABLE
PIVOT
(
MAX(DisplayAs) FOR AttributeId IN ([1],[2],[3],[4],[5],[6],[7],[8])) AS PivoTable ORDER BY UnitTypeID ASC
--SELECT * FROM @Table
DECLARE @TableStatus TABLE (UnitTypeId INT)
INSERT INTO @TableStatus
SELECT DISTINCT
UA.UnitTypeId
FROM
om_order_items_details ID
INNER JOIN
UnitType_Attributes UA ON UA.UnitTypeId = ID.UnitTypeId
SELECT DISTINCT
t.UnitTypeID
,UnitType
,Attribute1
,Attribute2
,Attribute3
,Attribute4
,Attribute5
,Attribute6
,Attribute7
,Attribute8
,CASE WHEN ts1.unittypeid = ua.unittypeid THEN 'Y' ELSE 'N' END AS 'Status'
FROM
@Table T
LEFT JOIN
@TableStatus TS1 ON TS1.UnitTypeId = T.UnitTypeID
LEFT JOIN
UnitType_Attributes UA ON UA.UnitTypeId = TS1.UnitTypeId
Member 9848727
31-May-13 4:54am
View
more than also i have upto 6
Member 9848727
25-May-13 4:07am
View
I want the case based on employeeid but not by salary
@@Basmeh Awad
Member 9848727
25-May-13 2:52am
View
Im not getting how to achieve the output
@@Anurag Sinha
Member 9848727
24-May-13 3:16am
View
ya its working thanku..
@@Arun Vasu
Member 9848727
24-May-13 3:08am
View
i dont want the last column from the output which you hace given to me
@@Arun Vasu
Member 9848727
24-May-13 3:06am
View
If im using in this way im getting '1' for the 'self' and 2 for the remaining relations
@@Aarti Meswania
Member 9848727
24-May-13 2:58am
View
Only 'self' must have to come first and then next any relation any can come...
If i use the above code it is displaying as 1,2,3,4,5 under the column relationship
Aarti Meswania
Show More