Skip to content
Advertisement

Tag: mysql

SQL select from inner join where count greater than

Doctor doctorid (PK) doctorname Patient patientid (PK) patientname doctorid I have the following query to get the doctors details with the number of patients that he/she consults. assume a patient has only one doctor to consult. Now I need to get the same information but only for the doctors who has more than 1 patients. Please suggest me a query.

What is this operator in MySQL?

I’m working on code written by a previous developer and in a query it says, What does <=> mean in this query? Is it something equal to =? Or is it a syntax error? But it is not showing any errors or exceptions. I already know that <> = != in MySQL. Answer TL;DR It’s the NULL safe equal operator.

how to use dynamic query inside a function

i’m trying to create a function GETUSERPROP(prop, filter_prop, filter_value) that selects one item in database filtering by property and value SET @_GET_PROP = “name”; SET @_FILTER_PROP = “id”;…

Select info from a table referencing info from another table

I have a main product table with different products. Different products have different specs, so I’ve created separate specs tables for each product (there will be more than ten of them). What I want to do is to show individual product’s specs on a product_page.php whenever the product is clicked. My product page has columns: My specs table columns So

SQL query by adding two columns in where clause?

I have a database table that contains two scores: scoreA scoreB I am trying to make a SQL query by adding these two values, such as However, it shows an error: Is there any way to work around for this? P.S. the reason I don’t add a new column for scoreC is because scoreA/scoreB are updated continuously by other cron

Use MySQL spatial extensions to select points inside circle

I have a table called flags that contains a column called coordinates that is full of MySQL ‘points’. I need to perform a query where I get all the flags within a circle based on a latitude and longitude position with 100m radius. From a usage point of view this is based around the user’s position. For example, the mobile

MSSQL BIT_COUNT (Hammingdistance)

Is there any function similar to the MYSQL BIT_COUNT function in MSSQL? I want to create a very simple Hammingdistance function in MSSQL that i can use in my selects. Here is what i have for MYSQL: Answer Why not just write your own bit_count code in T-SQL? There’s no need to use SQL CLR if all you need is

Advertisement