Building on Chris's post:
If you need only max by state you might try something like:
select yourtable.serialnumber, yourtable.name, yourtable.city, yourtable.state
Inner join (
select Max(serialnumber), state
group by state) as sub1
on yourtable.serialnumber = sub1.serialnumber
I currently have a table in SQL 2005 with two columns, one for Date, and one for Datetime. These are stored as nominal values, and is defined as the number of days since 12/30/1899, i.e. NOM_DATE 0 = 12/30/1899. Moment is defined as the number of minutes since 12/30/1899 12:00am (GMT), i.e. MOMENT 0 = 12/30/1899 12:00am.
My question is how would I go ahead and convert these into actual dates like dd/mm/yy,using a stored procedure?
You can only do that on the QA forums and not the general programming forums
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
Pls guys, i wrote some code which is supposed to be installed on other computers. but when i finished, it could only run on my system, and generates SQL database errors when installed on other systems. the code was written in C#, i used the sql compact server that comes with visual studio 2008.this is how i wrote the connection string:
Where does the 'DataDirectory' get put at? It's likely to be a permissions issue on Vista / Windows 7 if this is in the program files directory. Just guessing here as the actual error message was not included in the post.
Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
for example I have 1 query in who participate 3
columns in 2 table and I want to add 1 column in first table and column in query
will be 4. I want do this with code.
Not sure I understand what you are saying.
However you appear to be referring to that you now have the following:
select t.a, t.b, t.c from...
And you want the following:
select t.a, t.b, t.c, t.d from...
The problem with that is that SOMETHING is using the first query. And it is not going to magically use the second one. At best (depending on a number of things) it will simply do nothing at all. At worse something will fail in a way that makes it difficult to determine what happened.
So the best case has no impact - so no point in trying to change it.
In the worst case many things fail - so not point in trying to change it.
Thus it follows, what you think that you want to do will NOT work.
For an existing Access database holding around 100 queries, I'm looking for a comfortable way to export the actual SQL statements that represent those queries; ideally I'd like some (C#) code that generates a DataTable, with columns queryName and SqlStatement. Alternatively, a command or script that tells Access to create a text file holding such information. Or some magical SQL snippet that creates a new table in the database itself.
To be perfectly clear, I need the SQL statements, not the results of the queries themselves. And I'll need to run it a couple of times in the next few months, so I don't plan on doing it manually, one by one!