« first day (2147 days earlier)      last day (511 days later) » 

3:43 AM
@SunMaungOo That query looks valid to me, and should return that one row for you.
 
4:23 AM
@TehShrike, does the query really valid since I make up "RowNo"?
 
@SunMaungOo oh, sorry, no
my brain rewrote that query while I read it apparently
 
it's ok
everyone make mistake
 
you could do LIMIT 1,1 to accomplish the same thing
But it wouldn't be reliable, because you're not defining the order
If you don't put an ORDER BY in the query, then the order is non-deterministic
 
Basically, I wanted store List in the database.

and I wanted something like


List<int> dataSet=new List<int>();

if(dataSet[index]=="search value")
{
       return result
}

in TSQL
 
@SunMaungOo If you want to store an ordered list, you'll need to include an "order" or "sorting number" column
 
4:29 AM
@TehShrike, According to what I understand from my advise, I should make something like

SELECT FROM Department
WHERE SupervisorId=1
LIMIT 1,0
ORDER BY SupervisorId

but the sql will not need me search the result of row
 
Otherwise you have no guarantee that you'll get the list back in the same order
That's not how LIMIT works
 
@TehShrike, sorry if I confuse you. I mean "I wanted to store a list of item in the database."

For example, I wanted to store

List<int> dataSet=new List<int>(); into database (which I have already done)
 
The first number is the offset, the second number is how many rows you want to get back
@SunMaungOo yeah, I understood that part
If you care whether or not the list is ordered, you will need to store the order in the database explicitly, in a column
 
I wanted to represent

dataSet[i]=="search value"

in TSQL
where i = row number/index
 
@SunMaungOo yup, to do that, you will need to represent i in its own column in the table
 
4:32 AM
Wait, I will simplified the table for you
 
it won't change the answer :-x
 
I mean, I have done something like representing "i" in a column.
I just wanted to check with you (if you don't mind)
 
think of it this way: the table is not actually ordered in any particular way when it is stored
it only has an order if you give an ORDER BY in the query that's reading it out
Now, sometimes it will return rows in the same order when you run the same query, even without an ORDER BY, but you can't rely on that. Eventually it will do something different.
 
I understand that the result will be not in same order.
 
So in that example you're using SingerListId as the order?
 
4:37 AM
but isn't there I way to say "select RowNumber=2 if the WHERE clause return result [ORDER BY Something]"
Yes
SingerListId is a unique
 
@SunMaungOo yes, to do that you would use LIMIT
LIMIT 1,1 would return only the second result for your given query
 
I wanted something like "In the List of Singer, WHERE SingerList.RowNumber[2]=search value"
but I think LIMIT, doesn't handle such cases
since I am even checking the result of "LIMIT" in "WHERE" statement
 
which is true - SingerListId is unique, or SingerListId represents the order in the list?
You're correct, LIMIT doesn't handle that case. Like I said, you'll need to store i in the table to be able to run that query
 
SingerListId is "unique".

And I used

SingerListId | SingerId

1 | 1
1 | 2
2 | 1
I use it as both "unique" and to represent the order of the list
I finally get it, I need to store "Row Number" as "column". Thank for helping me out
 
hmm, I don't think you understand what I meant by order
Yup, that's what I meant :-) cool
 
4:43 AM
Basically I need something like

SingerListId  |  RowNumber | SingerId

1   |     1  |1
1   |     2  |2
2   |     3  | 1

so I can use

SELECT *
FROM Table
WHERE SingerListId =1 AND RowNumber=2 AND SingerId=2
I got another quick question (if you don't mind)
Does we need to use Reference Id in "View" even though the "View" is returning "nvarchar(max)"?
@TehShrike because

SELECT SongId, SongCode, Title, VolumeLevel, FormatType, DefaultTrack, FilePath, SongType, Language, Copyrights, CopyrightIsGroup, Bands, BandIsGroup, Recordings, RecordingIsGroup, Distributors, DistributorIsGroup, Singers, SingerIsGroup, AlbumName, Production, Lyrists, LyristIsGroup, Directors, DirectorIsGroup, Compsers, ComposerIsGroup, Arrangements, ArrangementIsGroup, ArrangementType, EventPlanners, EventPlannerIsGroup, Remark FROM SongView WHERE ( Title LIKE 'a%' )

is returning error "Error converting data type nvarchar to bigint.
 
@SunMaungOo What does ReferenceId represent?
@SunMaungOo That sounds like an error in the view's query
 
@TehShrike, I mean foreign key (as you can see from second image.) I return "nvarchar(max)" by JOINING with TitleId
 
hmm, I can't really see that from the image
 
@TehShrike, I finally found the error. I was looking at the totally wrong place. I thought my "JOIN" work because I was getting the correct result with my test data but the "JOIN" only work accidentally.

It was not a correct behavior.
Thank to you, I know to look up the right place
@TehShrike Thank a lot, I thought something is wrong with my "VIEW". Since you point out that you cannot see anything wrong from the image [my view], I finally open my eyes to look at other places.

Sorry if I am annoying you, I am not used to designing database
 
 
3 hours later…
8:07 AM
-1
Q: Compare 2 Class List in C#

Arijit MukherjeeCode: List<GetRationCardByID_Result> rc1 = new List<GetRationCardByID_Result>(); List<GetRationCardByID_Result> rc2 = new List<GetRationCardByID_Result>(); List<GetRationCardByID_Result> rcdiff = new List<GetRationCardByID_Result>(); for (int i = 0; i < alldupUID...

 
 
3 hours later…
11:06 AM
hi
 

« first day (2147 days earlier)      last day (511 days later) »