|
I'm working with MS Access to do some math. I'm taking a Cost and Dividing it by a decimal value to get a Price. I'm using a link table and a access sql query.
SQL Ex
Select (cost/markup) As Price From T_Cost;
Calulcation Ex. 1234 / .55 = 2243.6363 10...
Started by MaxGeek on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Why wouldn't you want the cents?.
However I'm curious.
That's what it's designed for.
To remove the numbers after the decimal point:
Int(number)
or in your case
Int(cost/markup)
New SQL is:
Select Int(cost/markup) As Price From T_Cost;
Use Round .
|
|
I have a database table with these two columns:
Amount: numeric (18,0) DecimalPlaces: numeric (18,0) This table can store amounts in various currencies, with the decimal place removed from the amount (I can't change this data model). For example, there...
Started by Andrew Swan on
, 7 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
In SQL.
And Oracle uses to_char() not Cast().
The Correct way to do this for SQLServer is to use STR:
Select STR(Amount, 18, DecimalPlaces in an Oracle query because Oracle SQL uses LENGTH() not LEN().
query.
|
|
I have a table of pages in my database, each page can have a parent as below:
id parent_id title 1 0 Home 2 0 Sitemap 3 0 Products 4 3 Product 1 5 3 Product 2 6 4 Product 1 Review Page
What would be the best MySQL query to select all pages ordered by ...
Started by Swanny on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Well, you can always get it all in one query and process it in PHP....
To any number of levels, you won't do it with a single query, you'll use a few building up the tree of the node, and then sort your query by level then by parent.
|
Ask your Facebook Friends
|
Hi, I am making a website where users add the place where they have visited.
There is 4 main tables
users (user_id,name ) places (place_id,type_id,place_name, city_id) user_place (user_id,place_id, date ) city(city_id,city_name)
Now I need to take with...
Started by DR.GEWA on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
C.city_name, placeCount.Cnt FROM places p INNER JOIN user_place up ON p.place_id = up.place_id INNER p.place_id, p.place_name, c.city, placeCount.Cnt FROM places p INNER JOIN user_place up ON p.place_id ( SELECT place....
|
|
I've seen this question around the internet ( here and here , for example), but I've never seen a good answer. Is it possible to find the length of time a given MySQL query (executed via mysql_query) took via PHP?
Some places recommend using php's microtime...
Started by eykanal on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
At the php level you pretty much would....
Or if you have shell access, just connect directly.
Use a tool like the MySQL Query Browser or SQLyog .
I you are only checking the quality of the query itself, then remove PHP from the equation.
|
|
I want to know what is the difference between a query and a view in terms of performance. And if a view is costly, what else besides a query could I do to improve performance?
Started by LuRsT on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
In SQL Server I believe that the performance difference between views and queries tables you are using to construct....
A view is still a query, it just abstracts certain parts of it so that your queries can be simplified query.
|
|
I have a result set that I want to filter.
Question is how can I run a query on a result set?
Using PHP and MySQL.
Thanks
Started by SunMaid Raisin on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You could load the original result set into a temporary .
You really should include the filter into the query itself, rather than pulling back a bunch search criteria in the appropriate places.
|
|
SQL query for a carriage return in a string and ultimately removing carriage return
I have some data in a table and there are some carriage returns in places where I don't want them. I am trying to write a query to get all of the strings that contain ...
Started by Maestro1024 on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
LIKE '%\n%'
Something like SELECT.
Omit the double quotes from your first query.
|
|
Hi, I'm looking for an API or a combination of API's where I can send "Anjuna, India" and get back a list of places nearby. The data is mostly for "third world" countries, less so for Europe/US. Any suggestions/ideas about how to structure this?
Answer Snippets (Read the full thread at stackoverflow):
Then go trought that list and calculate distance On Earth Identifier) for input location(s) Determine neighboring places A quick example, combining those APIs together with Yahoo's YQL would provide....
You would need place lists with coordinates.
|
|
I have fairly long and complex SQL query that is run against PostgreSQL 8.3. Part of the query involves filtering on a range of dates ending with today, like this:
where ... and sp1.price_date between current_date::date - '1 year'::interval and current...
Started by Evgeny on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The first variant even slower than the original....
Might be useful to see the entire query as well.
As to not having your user change your query at multiple places consider writing one is slower than the other.
Should be optimizable.
|