|
how do i get top 3 salaries among department, which is represented by employee with lowest 3 salaries (total 9 rows)
please reply.
|
|
|
|
|
Please rephrase your question or give some sample records as an example. It's hard to figure out what you really want.
|
|
|
|
|
Please explain ur question. Its not clear for me. Can u come up with any example?
abhi
|
|
|
|
|
It needs kind of presentation that what's your data and what you want as a final output.
Furthermore AFA I understood the problem I think you need to apply groupby in SQL and then after sort top 3 records among the retrieved result set.
further sample data can make me more clear regarding.
Regards,
Hiren.
be good(Help people in CP),do good(Vote if one finds helpful) all will happen good, In case happens bad(You are getting downvote for your best try to help OP) it will be good for later after(Countered with more points by humble member). - Gita sar in context of CP.
-So Guys don't care about downvote believe in you.
|
|
|
|
|
How to get data in financial year(april -march) in stored procedure in sql server 2005?I googled a lot.But didnt find suit answer.Hope you help.
|
|
|
|
|
Something like this you mean?
Inputparameter is int @fiscalyear.
WHERE (YEAR(yourdatefield) >= @fiscalyear AND MONTH(yourdatefield) >= 4)
AND (YEAR(yourdatefield) <= (@fiscalyear + 1) AND MONTH(yourdatefield) <= 3)
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
Because each company may have a different fiscal year, you need to actually have a strategy to deal with it in your data structure. there are a number of options!
Have a function that converts a date to finscalyear/period (2010/01 = April)
Actually store the correct fiscal values with the data.
Maintian a "Period" table with all the relevant dates and FK it to your data (we use this method)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My company is currently running SQL Server 2005 and we have out main project database set up on it. Everyone in the company can connect to it through Access using a linked table. This was setup a little while back by another company. However my company has now asked me to create a small database on the server. So I logged into the server, created the database, added the needed columns and the data we have already accumulated that need to be in the database. However when I try to link it through Access it won't let me; the connection fails. I can't do it through the ODBC Data Source Administrator either. I did notice though that when I try and create a new data source through the ODBC Admin that regardless of whether I select SQL Server or SQL Server Native Client 10.0 our main project database comes up (it is set up though to use SQL Server not the Native Client), however the new database only comes up if I select SQL Server Native Client 10.0. I'm thinking, and hoping, this is why I can't connect to the database from my laptop but I'm not sure. Why does the new database only come up under the SQL Native, but the main project database comes up under both, and how can I make the new database come up under the SQL Server option? I've compared both database properties and everything seems to be exactly the same. I'm pretty new to SQL Server but the company has put this on me and given me a week to get it up. Any help would be greatly appreciated. Thanks.
Dominick
|
|
|
|
|
First test is to see if you can "ping" the server. This will test that the network connection from your machine to the server is running.
Open a command prompt and type "ping yourservername", (no quotes and substitue your server name for the first parameter.
Start with the simple stuff.
|
|
|
|
|
So a summary of the problem is as follows.
There is ONE database server - one physical box.
On that server there is database A.
On that server you created database B.
On your client box you CAN do the following with A (NOT B.)
- Create an ODBC connection and validate it.
- Via a NEW Access database, create a linked table to it
And with Database B you CANNOT do the above.
Given that we know for sure that is NOT a connection problem (per the other response.)
And the driver shouldn't have anything to do with it.
What it would suggest to me is that it is one of the following
1. User permissions on the database B. This is most likely.
2. Some odd firewall rules. This is hypothetical but I don't consider it impossible. Such a rule would need to be more than just a standard connection rule.
|
|
|
|
|
I am going to have data that will be represented in code by multiple flag-type enums.
Is it preferable to store this data in a database record as the integer value of the enum instance, or should I have a separate field for each value and store either a zero or a one to indicate whether that field is in use?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Store the numeric value and have a translation/referential integrity table.
And see my GenOmatic[^] article.
|
|
|
|
|
Richard Andrew x64 wrote: I [...] have data that will be represented in code by multiple flag-type enums.
..and what's the relational representation of the same data?
I are Troll
|
|
|
|
|
Well, I'm writing a rules engine and it will go something like this:
Where subject A, B, C, and/or D
performs function A, B, C, and/or D
raise alert A, B, C, and/or D.
And each record in the database will represent one rule.
So the choices from A to D will be represented in code by flag enums.
And I'm wondering if it's better to store each of the choices as the int value of the enum, or as separate fields.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Then think of the typical searches you expect to perform on the data; that should tell you the most fitting answer.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Richard Andrew x64 wrote: So the choices from A to D will be represented in code by flag enums.
That description sounds more like a 'name' to me rather than an enum.
|
|
|
|
|
we can get month names by using select datename(mm,getdate()).How to select the month numbers(eg:1,2,3...12) using select statement in sql server?Please suggest the format to select month numbers.
|
|
|
|
|
You can use datepart to retrieve the month number in SQL Server.
|
|
|
|
|
Which database system?
Doesn't SQL server use DatePart?
|
|
|
|
|
In MS SQL server you can use MONTH(mydate)
|
|
|
|
|
Have your Google powers abandoned you? looking for SQL date functions, you would easily get this page[^] that summarizes it all.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
you can simply use select Month(getdate()) to display month in number.
|
|
|
|
|
Dear Alll,
i have the following:
Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = '" & Me.Text12.Value & "'";)
when it runs it give me this error : DataType mismatch in criteria expression
but the item_classification_id is a number feild (using access 2007), and Me.text12.value returns an integer. i have checked it 100's of time, it drives crazy...
may be am missing a thing , am not that good in coding, any clues ???
Regards.
0 will always beats the 1.
|
|
|
|
|
You are enclosing the value obtained from the Text12 textbox in single quotes. That's correct for a text value but not for a numeric value - hence your data mismatch error.
Modify your query as follows:
Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = " & Me.Text12.Value & ";")
|
|
|
|
|
thanks aloooooot
regards,
0 will always beats the 1.
|
|
|
|