Skip to main content

All Questions

Tagged with
0 votes
4 answers
2k views

Mysql - joins - too many rows are being returned - one for each of the joined table but dont want that

I have this kind of mysql db (table name/fields) tbl_users: id, title, approved tbl_photos: id, user_id, title, filename I have one row in users, and three photos (all with user_id = the id of ...
user avatar
1 vote
3 answers
5k views

if table does not exist execute a long query

I am using MySQL 5.0+ and I am trying to execute a big list of commands if a table does not exist. So I would like to have: if not exist table then 10000 line query that creates and populates the ...
Quillion's user avatar
  • 6,486
1 vote
4 answers
67 views

Building a SQL to calculate the number of rows relating to the parent

I am finding it hard to build a SQL, on the following database schema, Shop id name Order id shop_id date amount You can see that a shop can have many orders. I would like to a build a SQL that gives ...
bobo's user avatar
  • 8,727
1 vote
6 answers
5k views

What's is the maximum variables the sql "in" statement can handle

As said above For instance WHERE In(var 1,var 2,var 3, ..., var 5609,) Any limits before it slows the machine down ?
Matt's user avatar
  • 13